This function uses internally .collapse_timestamp and
summarise_all. Arguments to control these functions
can be passed as `...`. Arguments for each function are spliced and applied
when needed. Be advised that all arguments passed to the summarise_all function
will be applied to all the summarising functions used, so it will fail if any
of that functions does not accept that argument. To complex function-argument
relationships, indicate each summary function call within the .funs
argument as explained here summarise_all:
# This will fail beacuse na.rm argument will be also passed to the n function,
# which does not accept any argument:
summarise_by_period(
data = get_sapf_data(ARG_TRE),
period = '7 days',
.funs = list(mean, sd, n()),
na.rm = TRUE
)# to solve this is better to use the .funs argument:
summarise_by_period(
data = get_sapf_data(ARG_TRE),
period = '7 days',
.funs = list(~ mean(., na.rm = TRUE), ~ sd(., na.rm = TRUE), ~ n())
)