str(catopsis) shows no labels, so how can biplot know what to use?

Try this before call prcomp:

colnames(catopsis) <- c('a','b','c','d')
rownames(catopsis) <- cat$sample

Also, see the 'reshape' package for easier data manipulation.

Kevin


On Mon, Jan 25, 2010 at 10:39 AM, colin1 <colinhindma...@talktalk.net>wrote:

>
> The script below successfully produces a biplot of the data but the 'site
> names' (rows) and the names of the 'response variables' (columns) are shown
> as simple numerals (rather than the column and row names). How might I
> 'enforce' the use of the row/column names used in the datafile (section of
> datafile shown below)?
> Can anyone help, please?
>
> Section of datafile
>
> sample  a       b       c       d ---n42
> HBR-6   1       1       1       1
> HBR-7   1       1       1       2
> HBR-8   1       1       1       1
> HBR-9   1       1       1       2
> HBR-10  1       1       1       1
> HBR-11  1       1       1       1
> HBR-12  1       1       1       1
> HBR-13  1       1       1       1
> HBR-14  2       1       2       2
> HBR-15  2       1       2       1
> HBR-16  1       1       2       1
> HBR-17  1       1       2       1
> HBR-18  1       1       2       1
> HBR-19  1       1       2       1
> HBR-20  1       1       2       1
> HBR-21  1       2       1       1
> HBR-30  1       1       2       2
> HBR-31  1       2       1       2
> HBR-32  2       2       1       2
> HBR-33  1       2       1       2
> HBR-34  1       2       2       2
> HBR-35  1       2       2       1
> HBR-36  1       2       1       2
> HBR-37  1       2       1       2
>
>
> cat <-read.table("R855868825matrix.csv", sep=",", header=T)
>  head (cat, n=24)
> catopsis <- (cbind(cat$a, cat$b, cat$c, cat$d, cat$e, cat$f, cat$g, cat$h,
> cat$i, cat$j, cat$k, cat$l, cat$m, cat$n, cat$o, cat$p, cat$q, cat$r,
> cat$s,
> cat$t, cat$u, cat$v, cat$w, cat$x, cat$y, cat$z, cat$aa, cat$ab, cat$ac,
> cat$ad, cat$ae, cat$af, cat$ag, cat$ah, cat$ai, cat$aj, cat$ak, cat$al,
> cat$am, cat$an, cat$ao, cat$ap))
> pca <- prcomp (t(catopsis))
> plot(pca, catopsis [])
> summary(prcomp(catopsis))
> biplot(prcomp(catopsis, scale = TRUE))
>
> --
> View this message in context:
> http://n4.nabble.com/PCA-Showing-file-datalabels-on-biplot-tp1289524p1289524.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@r-project.org 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.
>



-- 
Kevin Wright

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org 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.

Reply via email to