[R] how to add labels to existing plot for the subset of data
Xin Shi
jasonshi510 at hotmail.com
Fri Mar 13 17:20:15 CET 2009
Dear:
I am trying to plot x against y for a particular subset of data, say z=1,
and labelling data by another variable say, k.
My data are:
y<-c(69.7, 82.3, 66.3, 107.3, 90.1, 63.7, 82, 74.4, 61.7, 93.4,
73.4, NA, NA, 70.7, 67.7, NA, NA)
x<-c(71.2, 82.6, 67.4, 107.1, 90.5, 66.7, 83.9, 73.9, 61, 93.1,
75.8, 79, 83.8, 73.1, 69.7, 73.3, 85.5)
z<-c(1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1)
k<-c(9, 10, 11, 12, 16, 23, 24, 25, 20, 19, 8, 21, 13, 17, 14, 15,
18)
plot(y~x,subset=z==1)
text(x=x,y=y,labels=k)---for this command, how can I only plot the label for
z=1? For example, give a constrict: subet=z==1. however this command is not
working for "text".
Anyone has this experience?
Thanks!
More information about the R-help
mailing list