[R] extracting subset from a data frame

Thomas Lumley tlumley at u.washington.edu
Tue Jul 3 19:13:11 CEST 2001


On Tue, 3 Jul 2001, David White wrote:

>
> Dear list,
>
> How can I subset a factor level out of a dataframe and into another?
>
> Ex.
>     token	       max1     max2     condition    prop1     prop2
> 879 n224ti10.10msmeanc 2928.516 6201.562 out of range 0.5273416 0.5454564
> 880 n224ti11.10msmeanc 3100.781 6718.359 out of range 0.7369985 0.4668726
> 881 n224tu01.10msmeanc 2928.516 6373.828 out of range 0.5116092 0.5293684
> 18  n002tu06.10msmeanc 2756.250 7579.688 within range 0.5245017 0.4614441
> 39  n011ku02.10msmeanc 1722.656 5340.234 within range 0.5297173 0.5002062
> 40  n011ku03.10msmeanc 1894.922 5167.969 within range 0.6348299 0.6518556
> 43  n011ku06.10msmeanc 1894.922 5512.500 within range 0.6487249 0.5513902
>
> Suppose I need to subset all of the within range observations into another
> dataframe.
>

another.dframe<-dframe[dframe$condition=="within range",]


	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list