Given a DataFrame an an expression, I would like to be able to subset the Dataframe using this expression. Also I would like to receive the index vector telling me which rows satisfy the conditions. I provide an example:
df = DataFrame(x1 = 1:3, x2 = [2, 1, 2],x3 = [22, 21, 20])
ex=:((x3 .< 22) & (x2 .== 2))
df1=df[(df[:x3].<22) & (df[:x2].==2),:]
idx=(df[:x2].==2) & (df[:x3].<22)
Is it possible to get df1 and idx using the Expression ex?
I think that the "with" function of DataFrames did this once: idx=with(df,ex)
Now there is https://github.com/JuliaStats/DataFramesMeta.jl ,however I cannot find the right function.
Thanks