Skip to content

PCA: Showing file datalabels on biplot

3 messages · colin1, Kevin Wright

#
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))