对于Orange
数据框,为什么以下不起作用?
library(plyr)
> ddply(Orange, .(Tree), summarise, circum = list(circumference))
Error: unsupported type for column 'circum' (VECSXP)
我想将所有圆周值合并为1列。
> dput(Orange)
structure(list(Tree = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("3",
"1", "5", "2", "4"), class = c("ordered", "factor")), age = c(118,
484, 664, 1004, 1231, 1372, 1582, 118, 484, 664, 1004, 1231,
1372, 1582, 118, 484, 664, 1004, 1231, 1372, 1582, 118, 484,
664, 1004, 1231, 1372, 1582, 118, 484, 664, 1004, 1231, 1372,
1582), circumference = c(30, 58, 87, 115, 120, 142, 145, 33,
69, 111, 156, 172, 203, 203, 30, 51, 75, 108, 115, 139, 140,
32, 62, 112, 167, 179, 209, 214, 30, 49, 81, 125, 142, 174, 177
)), .Names = c("Tree", "age", "circumference"), row.names = c(NA,
35L), class = c("nfnGroupedData", "nfGroupedData", "groupedData",
"data.frame"), formula = circumference ~ age | Tree, labels = structure(list(
x = "Time since December 31, 1968", y = "Trunk circumference"), .Names = c("x",
"y")), units = structure(list(x = "(days)", y = "(mm)"), .Names = c("x",
"y")))