[R] selecting parts of a table

David Winsemius dwinsemius at comcast.net
Wed Jan 14 20:48:35 CET 2009


Assuming that your dataframe is DF and those are names of columns then

?subset

 > DF <- data.frame(posit=runif(20, max=20), tvalues = runif(20, max=  
10))
 >
 > subset(DF, subset= posit > 10 & tvalues > 3.5 )
       posit  tvalues
4  14.66464 9.527535
6  14.71280 7.231015
9  14.76594 7.626381
10 14.05379 7.198893
11 14.23830 7.219855
12 17.47984 3.844767
13 10.95396 4.639608
15 13.21104 6.828144
19 11.75401 5.249528
20 12.95288 6.963767

.. should do the trick
On Jan 14, 2009, at 10:41 AM, emj83 wrote:

>
> I have a dataframe called Match with two columns: position and tvalue.
>
> I would like to select the parts of the dataframe that have a  
> position> 10
> but <50 and tvalues >3.5 as a new stand alone dataframe.
>
> Could anyone help me with how to do this?
>
> Thanks Emma
> -- 
> View this message in context: http://www.nabble.com/selecting-parts-of-a-table-tp21458521p21458521.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list