cut_Datetime | R Documentation |
cut_Datetime
is a wrapper around lubridate::round_date()
(and friends)
combined with dplyr::mutate()
, to create a new column in a light logger
dataset with a specified binsize. This can be "3 hours"
, "15 secs"
, or
"0.5 days"
. It is a useful step between a dataset and a visualization or
summary step.
cut_Datetime(
dataset,
unit = "3 hours",
type = c("round", "floor", "ceiling"),
Datetime.colname = Datetime,
New.colname = Datetime.rounded,
group_by = FALSE,
...
)
dataset |
A light logger dataset. Expects a |
unit |
Unit of binning. See |
type |
One of |
Datetime.colname |
column name that contains the datetime. Defaults to
|
New.colname |
Column name for the added column in the |
group_by |
Should the data be grouped by the new column? Defaults to |
... |
Parameter handed over to |
a data.frame
object identical to dataset
but with the added
column of binned datetimes.
#compare Datetime and Datetime.rounded
sample.data.environment %>%
cut_Datetime() %>%
dplyr::slice_sample(n = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.