Hi, Try this: subset(data, subset=(X3==3 & X2==2 & X1==2)) X1 X2 X3 3 2 2 3
First, you have numerical values, so don't quote them. Second, take a look at ?"&&" to understand the difference between & and &&. HTH, Ivan Le 10/7/2010 10:43, behave a écrit :
hi all, how do I filter a dataframe. What I am looking for is something like: data<-data.frame(matrix(c(2,2,1,2,2,2,2,2,3),byrow=TRUE,ncol=3)) subset(data, subset=(X3=="3"&& X2=="2"&& X1=="2")) thanks
-- Ivan CALANDRA PhD Student University of Hamburg Biozentrum Grindel und Zoologisches Museum Abt. Säugetiere Martin-Luther-King-Platz 3 D-20146 Hamburg, GERMANY +49(0)40 42838 6231 ivan.calan...@uni-hamburg.de ********** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php ______________________________________________ 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.