这是我的代码试图制作一个表:
table <- data.frame(expand.grid(
health = factor(c("support", "oppose"), levels = c("support", "oppose")), +
information = factor(c("support", "oppose"), levels = c("support", "oppose")), +
gender = factor(c("male", "female"), levels = c("support", "oppose")),
count = c(76, 160, 6, 25, 114, 181, 11, 48)))
R说unexpected '=' after info
。我的教授在课堂上做了一个这样的例子,他的代码很有效。我正在尝试做一个数据的对数线性模型
答案 0 :(得分:0)
删除+
s:
table<- data.frame(expand.grid(health=factor(c("support", "oppose"),
levels=c("support", "oppose")), information = factor(c("support",
"oppose"), levels=c("support", "oppose")), gender = factor(c("male",
"female"), levels=c("support", "oppose")), count=c(76, 160, 6, 25, 114,
181, 11, 48)))
它们可能来自复制/粘贴R控制台中代码的回显,但是会出现语法错误。