相关疑难解决方法(0)

为什么不能在`dcast`中有几个`value.var`?

为什么不能在一个有多个变量传递给value.vardcast?来自?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等)?

r dataframe reshape2

5
推荐指数
3
解决办法
7733
查看次数

标签 统计

dataframe ×1

r ×1

reshape2 ×1