tags:

views:

65

answers:

2

I have this

d[d$Age > "2", ]

and it returns all the rows that have an Age of over 2, but I want to only return the values in a few of the columns, say d$X and d$Y, not all of them.

anyway i can do this?

Thanks

+8  A: 
d[d$Age > "2", c("X","Y")]
deinst
+5  A: 

Other way

subset(d, Age > "2", select=c(X, Y))
Marek
+1 Cool. I always learn something new from Marek!
Michael Dunn