[R] unique/subset problem

Weiwei Shi helprhelp at gmail.com
Fri Jan 26 17:26:30 CET 2007


Then you need to provide more details about the calls you made and your dataset.
For example, you can tell us by
str(prunedrelatives, 1)

how did you call unique on prunedrelative and so on? I made a test
data it gave me what you wanted (omitted here).

On 1/26/07, lalitha viswanath <lalithaviswanath at yahoo.com> wrote:
> Hi
> The pruned dataset has 8 unique genomes in it while
> the dataset before pruning has 65 unique genomes in
> it.
> However calling unique on the pruned dataset seems to
> return 65 no matter what.
>
> Any assistance in this matter would be appreciated.
>
> Thanks
> Lalitha
> --- Weiwei Shi <helprhelp at gmail.com> wrote:
>
> > Hi,
> >
> > Even you removed "many" genomes1 by setting score<
> > -5; it is not
> > necessary saying you changed the uniqueness.
> >
> > To check this, you can do like
> > p0 <- unique(dataset[dataset$score< -5, "genome1"])
> > # same as subset
> > p1 <- unique(dataset[dataset$score>= -5, "genome1"])
> >
> > setdiff(p1, p0)
> >
> > if the output above has NULL, then it means even
> > though you remove
> > many genomes1, but it does not help changing the
> > uniqueness.
> >
> > HTH,
> >
> > weiwei
> >
> >
> >
> > On 1/25/07, lalitha viswanath
> > <lalithaviswanath at yahoo.com> wrote:
> > > Hi
> > > I am new to R programming and am using subset to
> > > extract part of a data as follows
> > >
> > > names(dataset) =
> > > c("genome1","genome2","dist","score");
> > > prunedrelatives <- subset(dataset, score < -5);
> > >
> > > However when I use unique to find the number of
> > unique
> > > genomes now present in prunedrelatives I get
> > results
> > > identical to calling unique(dataset$genome1)
> > although
> > > subset has eliminated many genomes and records.
> > >
> > > I would greatly appreciate your input about using
> > > "unique" correctly  in this regard.
> > >
> > > Thanks
> > > Lalitha
> > >
> > >
> > >
> > >
> >
> ____________________________________________________________________________________
> > > TV dinner still cooling?
> > > Check out "Tonight's Picks" on Yahoo! TV.
> > >
> > > ______________________________________________
> > > 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
> > > and provide commented, minimal, self-contained,
> > reproducible code.
> > >
> >
> >
> > --
> > Weiwei Shi, Ph.D
> > Research Scientist
> > GeneGO, Inc.
> >
> > "Did you always know?"
> > "No, I did not. But I believed..."
> > ---Matrix III
> >
>
>
>
>
> ____________________________________________________________________________________
> Bored stiff? Loosen up...
> Download and play hundreds of games for free on Yahoo! Games.
> http://games.yahoo.com/games/front
>


-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

"Did you always know?"
"No, I did not. But I believed..."
---Matrix III



More information about the R-help mailing list