w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
dcast fun.aggregate parameters

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)

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.