这项工作不到一个月前。有什么变化? (添加简单样本):
adk47sample
PeakName Elevation
Marcy 5344
Marcy 5344
Marcy 5344
Marcy 5344
Marcy 5344
Marcy 5344
Marcy 5344
Algonquin 5114
Algonquin 5114
Algonquin 5114
> require(plyr)
Loading required package: plyr
> adk.need.fr.round.6 <- ddply(adk47sample, .(PeakName, Elevation),
+ summarize, needThese=if(length(PeakName) < 6) "needThis")
Error in class(output[[var]]) <- class(value) :
attempt to set an attribute on NULL
对于这个我预期的简单例子:
> adk.need.fr.round.6
PeakName Elevation needThese
1 Algonquin 5114 needThis
答案 0 :(得分:3)
如果{@ 1}} plyr
结果为else
而@joran建议(character(0)
出现同样的错误),那么else NULL
版本为1.8适用于我:< / p>
adk.need.fr.round.6 <- ddply(adk47sample,
.(PeakName, Elevation),summarize,
needThese=if(length(PeakName) < 6) "needThis" else character(0))