I ask help for solving a big issue I'm having lately. I get a data frame like
df <- data.frame(x=c("c1","c2","c3"),A=c(0,1,-1),B=c(2,0,1),C=c(0,-1,-1))
and a file "tmp.csv" with the following conditions
A>0
B>1
C<0
I need to load these conditions, parse them and apply them on the data frame. so, for A I expect c1 and c2. for B, c1 and for C, c2, c3.
I've been trying to find something similar here but I didn't. maybe here there's a similar problem but I didn't get the solution. I also found the function
parse
that it might do the parsing but even reading the documentation I didn't get what it does...
I really don't know from to start (parse and make understand the conditions on the prompt). any help?
edit: I add here another request very close to the present one. if I need to check which "cx" satisfies all the conditions (here only A and B, let's discard C) and not taken one per time, what should I do?
I thought of using simply
lines <- readLines("tmp.csv")
expr <- lapply(lines, function(t) parse(text=t)[[1]])
do.call("subset", list(quote(df), expr))
but I get the error "'subset' must be logic".