Dear all,
how can I remove the row of a dataframe whose selected column matches the value of another dataframe? essentially, is there an equivalent of R’s %in%
operator in Julia?
Thanks
Please make an MWE for actual code.
Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer.
Keywords are highlighted to make it easier to refer to specific points.
Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …
That said, you may find the following useful:
Hi everyone, I want to compare if elements of vector x are in elements of vector y.
In R, I can do this as follows:
> x <- c("a", "b", "c")
> y <- c("b", "a")
> x %in% y
[1] TRUE TRUE FALSE
In Julia, I can do this as follows:
julia> x = ["a", "b", "c"];
julia> y = ["b", "c"];
julia> in.(x, Ref(y))
3-element BitArray{1}:
false
true
true
Now let’s make the vector big:
In R,
> set.seed(123)
> x <- rnorm(100000, 1000, 2)
> y <- rnorm(100000, 1000, 2)
> system.time(x %in% y)
user sy…