Try this:

split(myDF, myDF$myField)

On Wed, Jan 26, 2011 at 8:18 AM, Aditya Bhagwat <bhagwataditya@gmail.com>wrote:

> 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]]
>
> ______________________________________________
> 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

	[[alternative HTML version deleted]]

