[R] Questions on formula in princomp
Berton Gunter
gunter.berton at gene.com
Sat Apr 15 01:02:03 CEST 2006
One of the components of the returned princomp() objects can be $scores, the
matrix of scores. You can plot these as usual using any characters you like
via the 'pch' parameter of plot:
e.g.
## groups is a factor giving the groups for each data value.Assuming three
groups
myscores<-[princomp(...,scores=TRUE)$scores
plot(myscores[,1:2],pch=c('s','c','v')[groups])
Of course, this is not quite a biplot, but it's close.
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
"The business of the statistician is to catalyze the scientific learning
process." - George E. P. Box
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Sasha Pustota
> Sent: Friday, April 14, 2006 3:35 PM
> To: r-help at stat.math.ethz.ch
> Subject: Re: [R] Questions on formula in princomp
>
> Ok, that was just my wishful thinking.
>
> Is there a way to plot repeated labels that identify groups, e.g.
> factor(c(rep("s",50),rep("c",50),rep("v",50)))
>
> instead of 1--150 row indices, using something like
> biplot(princomp(lir)) ?
>
>
> Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> > Just use model.frame to examine what is passed:
> >
> > > ir <- rbind(iris3[,,1], iris3[,,2], iris3[,,3])
> > > lir <- data.frame(log(ir))
> > > names(lir) <- c("a","b","c","d")
> > > lir[1,1] <- NA
> > > mf <- model.frame(~., lir,na.action=na.omit)
> > > head(mf)
> > a b c d
> > 2 1.589235 1.098612 0.3364722 -1.6094379
> > > head(lir)
> > a b c d
> > 1 NA 1.252763 0.3364722 -1.6094379
>
> ______________________________________________
> 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
>
More information about the R-help
mailing list