I have this data set
names age height weight
1 joe 23 170 65
2 jack 25 173 73
3 jim 27 168 71
4 james 23 172 70
and I want to get all the info for people under 173 height, so I do this
short <- c(t(subset(dfD, height < 173, select = names)))
short returns this
[1] "joe" "jim" "jack"
But when I try to get all the data from that list…
dfD[(dfD[1] == short),]
it returns only this
names age height weight
1 joe 23 170 65
How can I get this to work?
I want to be able to create name lists and get all their data that way…how is it possible?
subset()anddlply()will select a subset of a data frame, and change the data frame into a list. Is this what you want?OR