[R] data point labeling in xyplot

peyman zirak.p at gmail.com
Fri Dec 13 18:43:22 CET 2013


Hi Folks,

I have data with a format like:

ID    y    param1    param2    groupingFactor1    groupingFactor2.....
1    ...   
1
1
1
2
2
2
2
3
3
3

so several grouping factors and repeated measures. I am using trellis
and xyplot to get plot with several grouping factors.
something like xyplot(y~x|grouping1*grouping2, data=na.omit(mydata),
panel=function{panel.xyplot(x,y);....}); Lets say x is the x axis
parameter and y the one for y.
So this will produce a plot with 4 windows which groups data according
to all combinations of groupingFactor1 and groupingFactor2.

Now I want to label the data points in each of these four plot windows
with the "ID" (ID is an integer representing the subject number). I used
the ltext(x=x,y=y,...), but then it uses the superscripts for the all
data set and dose not mark the data correctly. It only works if I ignore
the grouping and have all my data in one single plot window. It seems
that I should somehow pass the correct subscripts for the data in each
plot window (or group), but I could not figure it out.

thanks,



More information about the R-help mailing list