does this explain it?


> groups <- factor(c(rep("Z",5),rep("X",5),rep("Y",5)))
>
> groups
 [1] Z Z Z Z Z X X X X X Y Y Y Y Y
Levels: X Y Z
> as.integer(groups)
 [1] 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2
 > c(1,2,3)[groups]
 [1] 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2
>
On 4/14/06, Sasha Pustota <popgen@gmail.com> wrote:
>
> Sasha Pustota <popgen@gmail.com> wrote:
> > Berton Gunter <gunter.berton@gene.com> wrote:
> > > plot(myscores[,1:2],pch=c('s','c','v')[groups])
> >
> > Thanks, this works. How to understand the result of
> > the expression
> >
> >    > c(1,2,'3)[groups]
> >     [1] 3 3 3 3 3 1 1 1 1 1 2 2 2 2 2
> >
> > where
> >
>
> >    > groups <- factor(c(rep("X",5), rep("Y",5), rep("Z",5)))
>
> bzz... this should be
>
>      > groups <- factor(c(rep("Z",5),rep("X",5),rep("Y",5)))
>
> ______________________________________________
> R-help@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
>



--
Jim Holtman
Cincinnati, OH
+1 513 646 9390 (Cell)
+1 513 247 0281 (Home)

What the problem you are trying to solve?

	[[alternative HTML version deleted]]


