[R] Question with lattice xyplot

From: Ghosh, Sandeep <sghosh_at_lexgen.com>
Date: Wed 23 Mar 2005 - 03:26:49 EST

Hi All,

I have a quick question and any help is greatly appreciated. For the following data when I try to produce the image using xyplot function in lattice package, the key has 4 rows instead of 2. Can anyone tell me what I'm doing wrong and what is the way to fix the problem. Here the code that I'm running

studyData <- as.data.frame(t(structure(c(


), .Dim=c(3,24))));
colnames(studyData) <- c('treatment','timeInterval','foldChange');

treatmentCount <- length(levels(studyData$treatment)); studyData[c("timeInterval", "foldChange")] <- lapply(studyData[c("timeInterval", "foldChange")], function(x) as.numeric(levels(x)[x]));

studyData <- studyData[do.call("order", studyData), ]; trellis.par.set(theme = col.whitebg());

print(xyplot(foldChange ~ timeInterval, data=studyData, type='b', groups = treatment, pch=1:treatmentCount,
key = list(points = list(Rows(trellis.par.get("superpose.line"), c(1:treatmentCount)), col=Rows(trellis.par.get("superpose.line"), c(1:treatmentCount))$col, pch = 1:treatmentCount, type='b'),

	   cex = trellis.par.get("superpose.symbol")$cex[1:treatmentCount], 
	   text = list(lab = as.character(unique(studyData$treatment))), 
	   columns = 1, 

ylab="Relative Change(1=12.50%tile)",
xlab="Time Interval (hour)"));


        [[alternative HTML version deleted]]

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 Wed Mar 23 03:30:39 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:53 EST