df <- data.frame(A=c(1,2), B=c(1,1))

I have a string containing a condition for a subset function, like:
conditionAsString <- paste(names(df), df[1,], sep="==", collapse=" & ")
 > conditionAsString
 > "A==1 & B==1"

Now I want to use this string in the subset call, like

subset(df, conditionAsString)

I do not exactly now how to combine substitute, expression, parse and  
so on to get what I want, which would be:

subset(df, A==1 & B==1)

but using the string conditionAsString.

Thanks,
Mark
–––––––––––––––––––––––––––––––––––––––
Mark Heckmann
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com





        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to