# Is array/vector handling this hard?

**URL:** <https://discourse.julialang.org/t/is-array-vector-handling-this-hard/104035>\
**Category:** New to Julia\
**Created:** [September 19, 2023, 5:56pm UTC](https://discourse.julialang.org/t/is-array-vector-handling-this-hard/104035 "2023-09-19T17:56:03Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [September 19, 2023, 6:18pm UTC](https://discourse.julialang.org/t/is-array-vector-handling-this-hard/104035/4 "2023-09-19T18:18:37Z")

</div>

Using a vector of indices is completely fine by itself. However in your case, where you also want a complement it is not the best choice. You could just use a BitVector of indexing.

```julia
mask = falses(size(features, 1))
mask[selected] .= true
# now you can do
features[mask, :] # selected features
features[.!(mask), :] # not selected features

```

If the data is very large you can also consider using views. For that just prepend a slicing operation with `@view` like in `@view features[.!(mask), :]`

Also Julia arrays are column-major, so `array[indices, :]` will generically be slower than `array[:, indices]`

---

_[View the full topic](https://discourse.julialang.org/t/is-array-vector-handling-this-hard/104035)._
