This function collapse the TIMESTAMP to the desired period (day, month...) by setting the same value to all timestamps within the period. This modified TIMESTAMP is used to group by and summarise the data.
sapflow or environmental data as obtained by
period to collapse by. See
funs to summarise the data. See details.
optional arguments. See details
This function uses internally
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
argument as explained here
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# 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()) )
A 'tbl_df' object with the metrics results. The names of the columns indicate the original variable (tree or environmental variable) and the metric calculated (i.e. 'vpd_mean'), separated by underscore
Previously to the collapsing step, a temporal variable called
TIMESTAMP_coll is created to be able to catch the real timestamp when
some events happens, for example to use the
min_time function. If
your custom summarise function needs to get the time at which some event
happens, use TIMESTAMP_coll instead of TIMESTAMP for that:
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10 11
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.