Skip to content
Prev 165236 / 398506 Next

Help in Lattice!

Write a panel= function:


dataM <- structure(list(ID = c(1L, 1L, 1L, 1L, 45L, 46L, 46L, 46L, 46L
), Dose = c(0L, 0L, 0L, 0L, 30L, 30L, 30L, 30L, 30L), Visit = c(0.5,
1, 1.5, 2, 3, 0.5, 1, 1.5, 2), Value = c(-0.065802, 0.24085,
-0.22907, 0.24074, -0.81316, -0.20786, -0.29336, -0.55657, -0.21659
)), .Names = c("ID", "Dose", "Visit", "Value"), class = "data.frame",
row.names = c("1",
"2", "3", "4", "270", "271", "272", "273", "274"))

library(lattice)
library(grid)
xyplot(Value ~ Visit | factor(ID), data = dataM, typ = 'o', as.table = TRUE,
	subscripts = TRUE, Dose = dataM$Dose,
	panel = function(x, y, subscripts, Dose, ...) {
		panel.xyplot(x, y, ...)
		grid.text(paste("Dose =", Dose[subscripts][1]), .15, .15,
			gp = gpar(cex = 0.6))
	}
)
On Fri, Dec 19, 2008 at 7:07 PM, Haoda Fu <fuhds at yahoo.com.cn> wrote: