[R] Discriminating between experiments with xyplot (lattice)

Christel u. Frank Sarfert cfsarfert at web.de
Fri Mar 16 22:39:17 CET 2007


Hi, 

suppose I have data from 3 experiments which show conversion as a function of 
time for different boundary conditions, e.g. pressure, temperature. I want to 
plot all experiments as conversion over time grouped according to the 
temperature. However, since I have more than one experiment performed at the 
same temperature (but different pressures) I end up figuring out which curve 
belongs to which experiment. (An example with artificial data of the 
structure I use is given below. It shows three experiments where two 
experiments at temp = 250 but press = 1 and press = 0.5 are plotted within 
one group.)
My question is: Is there a way to identify which curve whithin the same group 
belongs to which experiment, e.g by plotting a label like the experiment 
number to the end point, or by choosing different symbols for the different 
experiments - while keeping the color encoding of the groups?

Your help is greatly appreciated!

Best regards 
                      Frank


require(lattice)

## generating the data, I need
time <- seq(0,50,1)
conversion <- 2 * log(time + 1)
press <- rep(1,51)
temp <- rep(250,51)
experiment <- rep(1, 51)
v1 = as.data.frame(cbind(experiment,time,conversion,press,temp))

conversion <- 2.5 * log(time + 1)
press <- rep(1, 51) 
temp <- rep(270,51)
experiment <- rep(2, 51)
v2 = as.data.frame(cbind(experiment,time,conversion,press,temp))

conversion <- 1.25 * log(time + 1)
press <- rep(0.5, 51) 
temp <- rep(250,51)
experiment <- rep(3, 51)
v3 = as.data.frame(cbind(experiment,time,conversion,press,temp))

d <- rbind(v1,v2,v3)

## plotting
xyplot(conversion ~ time, data = d, groups = factor(temp), auto.key = T)

## result: the group for temp = 250 includes two experiments, which cannot be 
associated to the individual experiments 

-- 

C. u. F. Sarfert
Hauffstr. 8
70825 Korntal



More information about the R-help mailing list