| resample | R Documentation |
Buckets a datetime column to a grid (every) and aggregates within each
bucket – the time-series form of group_by() + summarise(). Equivalent
to mutate(<time> = floor_time(<time>, every)), group_by(<time>), then
summarise(...).
resample(.data, time, every, ..., .name = NULL)
.data |
A |
time |
The datetime column to bucket (unquoted). |
every |
Bucket size as a string, e.g. |
... |
Named aggregation expressions, as in |
.name |
Optional name for the bucket column. Defaults to the name of
|
A vectra_node with one row per occupied bucket: the bucket column
followed by the aggregates. The bucket collects as a numeric epoch value
(see floor_time() on restoring the date class).
floor_time(), summarise()
## Not run:
tbl("readings.vtr") |>
resample(timestamp, "1 hour", mean_temp = mean(temp), n = n()) |>
collect()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.