This "one liner" works great! Thanks (for all replies) > > Try this: > > subset(d, eval(parse(text = paste(paste(columns, values, sep = "=="), > collapse = " & ")))) >
>> >> 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 >> >> Blazej >> >> ______________________________________________ >> 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. > > > > -- > Henrique Dallazuanna > Curitiba-Paraná-Brasil > 25° 25' 40" S 49° 16' 22" O ______________________________________________ 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.