[R] xyplot() conventions for multiple conditioning vars lattice pkg

Doran, Harold HDor@n @end|ng |rom @|r@org
Fri Jul 19 15:28:08 CEST 2019


Here is a toy example of what I want

library(lattice)
result <- data.frame(score = 1:10, theta = seq(from = -5, to = 5, length = 10))
result$theta2 <- result$theta + .3
xyplot(score ~ theta + theta2, result,  type = c('g', 'l'))

However, in reality, the number of variables along the x-axis will vary in unknown ways. So, I collect them in a matrix, similar to something like

thetaMat <- cbind(result$theta, result$theta2)

I recall at one point being able to pass a matrix of some form, such as
xyplot(score ~ thetaMat[,1:ncol(thetaMat)], result, type = c('g', 'l'))

This fails, and I am cannot recall the right usage for doing this without having to stack the columns (which I'm hoping to avoid).

Can anyone suggest the right usage for this concept?

Thanks

Harold


	[[alternative HTML version deleted]]



More information about the R-help mailing list