What would be Julia code for the following R code:

a <- c(1:5)

b <- c(1:10)

c <- b[-a]

Thanks,

Patrik

What would be Julia code for the following R code:

a <- c(1:5)

b <- c(1:10)

c <- b[-a]

Thanks,

Patrik

In julia, how to realize a=b[-1:2] as in R without modifying b

I’m not an R expert, but you want the elements of `b`

which are NOT part of `a`

as well, right?

One way would be:

`c = Iterators.filter(x -> x ∉ a, b)`

(on lastest `master`

, if you’re on `0.5`

it would be `c = filter(x -> x ∉ a, b)`

).

NamedArrays implements a `Not`

method that does what the minus index does in R. I don’t know why a very common ideom like that is not in Julia Base though?

I made a PR for something like that in Base a long while back. Seems like a reasonable addition to me.

Thanks for your replies. setdiff() seems to be a work around, but that function is the same as %in% in R.