As always, please read the Help file, in particular the details on encoding of factors. It's dense, but it explains everything.
-- Bert > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Sasha Pustota > Sent: Friday, April 14, 2006 9:08 PM > To: [email protected] > Subject: Re: [R] Questions on formula in princomp > > jim holtman <[EMAIL PROTECTED]> wrote: > > 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 > > I did notice the lexicographical ordering of Z,X,Y. I don't understand > the meaning of c(1,2,3) "subscription" by a factor. I understand > subscription by an integer, or by a single item as in associative > arrays. Or does "[]" have a different meaning here? > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
