set.seed(1)
x <- rnorm(100)
f <- rep(0:1, each = 50)
y <- x + f - f*x + rnorm(100, sd = 0.5)
f <- factor(f, labels = c("Group1", "Group2"))
xyplot(y~x | f, layout(2,1))
然后为啥出现错误?
Error in layout(2, 1) : layout matrix must contain at least one reference to each of the values {1 ... 2}
已经知道原因,我没有抄对。layout(2,1)应该是layout=c(2,1)