[R] subsetting data frame using a vector of column names / values

Bl...j Kr....i b...m at gmail.com
Wed Jun 24 14:16:15 CEST 2009


Hello

I have a data frame d with columns "var1", "var2", "var3"

Then I have two vectors:
columns <- c("var2", "var3")
values <- c(0, 1)


Is there a compact way to subset the data frame
using these two vectors and get the result equivalent to:

select (d, var2==0 & var3==1)  ?

Thank You

Bl...j




More information about the R-help mailing list