【发布时间】:2010-09-30 06:50:29
【问题描述】:
要么太晚了,要么我发现了一个错误,或者演员不喜欢带有“。”的列名。在他们中。这一切都发生在函数内部,但它在函数外部“不起作用”,就像在函数内部不起作用一样。
x <- structure(list(df.q6 = structure(c(1L, 1L, 1L, 11L, 11L, 9L,
4L, 11L, 1L, 1L, 2L, 2L, 11L, 5L, 4L, 9L, 4L, 4L, 1L, 9L, 4L,
10L, 1L, 11L, 9L), .Label = c("a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k"), class = "factor"), df.s5 = structure(c(4L,
4L, 1L, 2L, 4L, 4L, 4L, 3L, 4L, 1L, 2L, 1L, 2L, 4L, 1L, 3L, 4L,
2L, 2L, 4L, 4L, 4L, 2L, 2L, 1L), .Label = c("a", "b", "c", "d",
"e"), class = "factor")), .Names = c("df.q6", "df.s5"), row.names = c(NA,
25L), class = "data.frame")
cast(x, df.q6 + df.s5 ~., length)
没用。
但是,如果:
colnames(x) <- c("variable", "value")
cast(x, variable + value ~., length)
像魅力一样工作。
【问题讨论】:
-
在 R 2.11.1 (W7)、reshape_0.8.3 和 plyr_1.2.1 上的行为相同。
标签: r