[R] newbie question: grouping rows

Matthew Scholz schmatthew at gmail.com
Sat Mar 11 01:41:21 CET 2006


Thanks for your response, Christos, but when I try this:

> new = old[old$q.D1 < 0.05,]

I get the following warning (and what I'm trying to do fails):

Warning message:
< not meaningful for factors in: Ops.factor(old$q.D1, 0.05)

I've tried to bone up on the topic of factors and searching R help,
but I'm still not sure why my data is being converted to that class
nor do I know how to undo the conversion or work around it. Thanks
again in advance of your advice. Any suggestions?

Matt

On 3/9/06, Christos Hatzis <christos at silicoinsights.com> wrote:
> 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