Do julia arrays support indexing with multiple ranges like the following
dat = Array(1:10)
# trying to get dat[[1:3, 6:8]] to result in
dat[[1,2,3,6,7,8]]
Looking for something that would be like the R equivalent dat[c(1:3, 6:8)]
?
The direct equivalent of the R version is
v = 1:10
v[ [1:3; 6:8] ]
since ;
is the concatenation operator:
julia> [1:3; 6:8]
6-element Array{Int64,1}:
1
2
3
6
7
8
You may also want to look at chain
in the Iterators.jl package: https://github.com/JuliaLang/Iterators.jl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With