Dear all,
I have a data frame 'myDf', in which one of the fields 'myField' can have
several possible values. To extract the observations for which it has value
"A", I can do:
subset(myDf, myField="A")
However, when I try to do this within a loop, it doesn't work, it returns
everything, and not a subset
for (currField in c("A", "B", "C")){
subset(myDf, myField=currField)
}
How should I modify the call of subset in the loop to make it work?
Thanks for your help!
Adi
--
Aditya Bhagwat
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.