为什么不能在一个有多个变量传递给value.var在dcast?来自?dcast:
value.var存储值的列的名称,请参阅guess_value以了解默认策略.
它没有明确指出只能将一个变量作为值传递给它.但是,如果我尝试,那么我得到一个错误:
> library("reshape2")
> library("MASS")
>
> dcast(Cars93, AirBags ~ DriveTrain, mean, value.var=c("Price", "Weight"))
Error in .subset2(x, i, exact = exact) : subscript out of bounds
In addition: Warning message:
In if (!(value.var %in% names(data))) { :
the condition has length > 1 and only the first element will be used
Run Code Online (Sandbox Code Playgroud)
那么有没有理由强加这种限制?是否有可能解决这个问题(也许使用reshape等)?