my question is besides defining a function outside of summarise_each with multiple argument, is there another way to add the argument directly in the summarise_each?
For example I want to get the mean without NAs.this way works
mean_fun=function(x)mean(x,na.rm=TRUE)
AA_group=AA_new %>% group_by(tractID)
AA_group %>% summarise_each(funs(mean_fun))
I am wondering whether there is a way to add na.rm=TRUE
directly to summarise_each
,such as more_args
option?
and also if I put mean_fun directly to summarise_each namely,
AA_group %>% summarise_each(funs(function(x)mean(x,na.rm=TRUE)))
and the error is
expecting a single value
Does that mean that every time we want to use summarise_each, we have to define a function outside of that?