[R] "text"-function: adding text in an x,y-plot

From: Helmut Kudrnovsky <hellik_at_web.de>
Date: Mon 30 May 2005 - 02:07:42 EST


Hello R-friends,

i have a question to the "text"-function.

a little test-dataset for better understanding:

-the dataset was imported with read.table(....,header=TRUE) s1-s10 are the samplenames

     var1 var2 var3
s1     1    1    2
s2     2    3    1
s3     2    2    3
s4     5    4    3
s5     4    2    3
s6     6    3    2
s7     8    5    4
s8     7    2    1
s9     9    3    2

s10 8 6 4

-then ive performed a pincipal component analysis with prcomp

-for displaying the result in a x,y-graph i transformed out.pca$x into the dataframe points
  points <- out.pca$x
> points

            PC1 PC2 PC3

s1  -4.7055777 -0.14781544 -0.3683602
s2  -3.1854599  0.19661476  1.5212455
s3  -3.2687980  0.78193513 -0.6352458
s4   0.2278948  1.00061498  0.2164108
s5  -1.4382847  0.02500633 -0.9114340
s6   0.6216283 -0.68606440  0.2071083
s7   3.4951878  1.17343675 -0.3266629
s8   1.0153619 -2.37274378  0.1978058

s9 3.3673983 -1.82145761 -0.2071739
s10 3.8706492 1.85047328 0.3063065

> lab

     V1
1 s1
2 s2
3 s3
4 s4
5 s5
6 s6
7 s7
8 s8
9 s9
10 s10

text(pca$PC1, pca$PC2, labels=lab)

is out there any idea what i'am doing wrong? is there maybe another way of displaying the samplenames at the right x,y-coordinate?

greetings from the sunny tirol with thanks in advance helli

platform i386-pc-mingw32

arch     i386
os       mingw32 - win xp

system i386, mingw32
status
major 2
minor 1.0
year 2005
month 04
day 18

language R

R-help@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 Received on Mon May 30 02:05:31 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:15 EST