dcast fun.aggregate parameters

后端 未结 1 1194
死守一世寂寞
死守一世寂寞 2020-12-20 17:47

In the R package reshape2, does the dcast() function parameter fun.aggregate= have the ability to accept parameters itself?

For instance:

1条回答
  •  有刺的猬
    2020-12-20 18:29

    Like many functions in R, dcast has a ... argument that is typically used to pass additional arguments on to a function. In fact, at ?dcast, you'll find this line in the "arguments section":

    ... further arguments are passed to aggregating function

    Thus, the correct way of writing your example would be:

    dcast(dataFrame, x ~ y, value.var = 'z', fun.aggregate = mean, na.rm = TRUE)
    

    0 讨论(0)
提交回复
热议问题