Re: [R] subseting a data frame

2012-03-02 Thread Rui Barradas
Hello, > HI, > this is my problem I want to subset this file df, using only unique > df$exon printing the line once even if df$exon appear several times: > > unique(df$exon) will show me the unique exons > If I try to print only the unique exon lines > with df[unique(df$exon),] -this doesn't pr

Re: [R] subseting a data frame

2012-03-02 Thread R. Michael Weylandt
Please always cc the list for archival/threading reasons. Sort answer is that unique() gives the unique elements rather than something you should subset by, like a set of logical indices or row numbers. Note that in general unique(x) == x[!duplicated(x)] I'd imagine there are cases where this

Re: [R] subseting a data frame

2012-03-02 Thread R. Michael Weylandt
I believe you want the duplicated() function. Michael On Mar 2, 2012, at 10:19 AM, nathalie wrote: > HI, > this is my problem I want to subset this file df, using only unique df$exon > printing the line once even if df$exon appear several times: > > unique(df$exon) will show me the unique e

[R] subseting a data frame

2012-03-02 Thread nathalie
HI, this is my problem I want to subset this file df, using only unique df$exon printing the line once even if df$exon appear several times: unique(df$exon) will show me the unique exons If I try to print only the unique exon lines with df[unique(df$exon),] -this doesn't print only the unique