Why can't one have several `value.var` in `dcast`?

前端 未结 3 1779
走了就别回头了
走了就别回头了 2020-12-18 07:57

Why can\'t one have multiple variables passed to value.var in dcast? From ?dcast:

value.var name of column whi

3条回答
  •  我在风中等你
    2020-12-18 09:02

    I had the same issue and I found this answer: Error using dcast with multiple value.var that suggests to "force" data.table dcast function as follows:

    # multiple value.var
    data.table::dcast(Cars93, AirBags ~ DriveTrain, mean, value.var=c("Price", "Weight"))
    

    I was able to cast multiple variables without error.

提交回复
热议问题