来自慕课网《R语言之数据可视化》课程3-6
代码如下
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}
而课程视频里面的老师用这个代码就没有问题,不知道我这里问题出在哪里,希望指教!
qq_肖西耶_0