[R] newbie question: grouping rows

Christos Hatzis christos at silicoinsights.com
Thu Mar 9 23:38:30 CET 2006


You can try:

new.dataframe <- my.dataframe[my.dataframe$p.value < 0.05, ]

This will select all columns.  Alternatively, you can specify the columns
that you want after the ",".

-Christos 

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Matthew Scholz
Sent: Thursday, March 09, 2006 5:18 PM
To: r-help at stat.math.ethz.ch
Subject: [R] newbie question: grouping rows

Hi all,

I have a very simple question that I can't seem to find the answer to.
How do I extract rows that meet a certain criteria  from a data frame and
group them into a new data frame? For example, if I want to make a new data
frame that only includes rows of data for which the p values (given by one
of the columns in the data frame) are less than a certain value, how do I do
this? It seems that there should be a simple function that does this. I
looked into getGroups from the nmle package, but am not sure how to
construct the form argument correctly or even if it's the appropriate way to
tackle this.

Thanks in advance of your answer,

Matt

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list