[R] Questions on formula in princomp

Sasha Pustota popgen at gmail.com
Sat Apr 15 04:44:42 CEST 2006


Sasha Pustota <popgen at gmail.com> wrote:
> Berton Gunter <gunter.berton at 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)))




More information about the R-help mailing list