我知道有一些线程(1,2)已经有了它并且我已经阅读了它们,但我仍然没有找到我的问题。
错误似乎是“随机”发生的,即使我确定它不是,但我可能只是不知道,何时。
因此我无法提供一个最小的例子,因为我还找不到“模式”。
但基本上我总是使用
hourly <- ddply(set, c("Date", "Hour"), summarise, avg = mean(Value))
导致
Error: 'names' attribute [11] must be the same length as the vector [1]
traceback()提供
> traceback()
6: stop(list(message = "Attribut 'names' [11] muss dieselbe Länge haben wie der Vektor [1]",
call = NULL, cppstack = NULL))
5: .Call("plyr_loop_apply", PACKAGE = "plyr", n, f)
4: loop_apply(n, do.ply)
3: llply(.data = .data, .fun = .fun, ..., .progress = .progress,
.inform = .inform, .parallel = .parallel, .paropts = .paropts)
2: ldply(.data = pieces, .fun = .fun, ..., .progress = .progress,
.inform = .inform, .parallel = .parallel, .paropts = .paropts)
1: ddply(set, c("Date", "Hour"), summarise, avg = mean(Value))
数据帧的str():
> str(set)
'data.frame': 2155 obs. of 16 variables:
$ T_Stamp : POSIXlt, format: "2013-06-18 09:01:00" "2013-06-18 09:02:00" "2013-06-18 09:03:00" ...
$ Date : Date, format: "2013-06-18" "2013-06-18" "2013-06-18" ...
$ Time : num 0.376 0.376 0.377 0.378 0.378 ...
$ Year : int 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 ...
$ Month : int 6 6 6 6 6 6 6 6 6 6 ...
$ Day : int 18 18 18 18 18 18 18 18 18 18 ...
$ Hour : int 9 9 9 9 9 9 9 9 9 9 ...
$ Min : int 1 2 3 4 5 6 7 8 9 10 ...
$ Customer: chr "1" "1" "1" "1" ...
$ Property: chr "1" "1" "1" "1" ...
$ Serial : Factor w/ 13 levels "000D6F00010B723F",..: 9 9 9 9 9 9 9 9 9 9 ...
$ Sensor : chr "AirCon" "AirCon" "AirCon" "AirCon" ...
$ ID : Factor w/ 44 levels "300","301","302",..: 30 30 30 30 30 30 30 30 30 30 ...
$ Unit : chr "Total Active Power" "Total Active Power" "Total Active Power" "Total Active Power" ...
$ Value : num 68 68.2 68.2 67.7 68.5 ...
$ Hourf : Factor w/ 13 levels "9","10","11",..: 1 1 1 1 1 1 1 1 1 1 ...
当使用ddply进行汇总时,有没有人知道一个人可以做的常见错误(正如我为计算方法所做的那样)?