按照老師的程序輸入為什么遇到了layout錯誤?
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}
2017-09-16
已經知道原因,我沒有抄對。layout(2,1)應該是layout=c(2,1)