mean_daily_metric | R Documentation |
mean_daily_metric
is a convenience wrapper around mean_daily
that
summarizes data imported with LightLogR per weekday and calculates mean daily
values for a specific metric. Examples include duration_above_threshold()
(the default), or durations()
.
mean_daily_metric(
data,
Variable,
Weekend.type = Date,
Datetime.colname = Datetime,
metric_type = duration_above_threshold,
prefix = "average_",
filter.empty = FALSE,
Datetime2Time = TRUE,
...
)
data |
A dataframe containing light logger data imported with LightLogR |
Variable |
The variable column to analyze. Expects a |
Weekend.type |
A (new) column in the dataframe that specifies the day of the week as a factor |
Datetime.colname |
Column name containing datetime values. Defaults to
|
metric_type |
The metric function to apply, default is
|
prefix |
String that is the prefix on summarized values |
filter.empty |
Filter out empty rows. Default is FALSE |
Datetime2Time |
Logical of whether POSIXct columns should be transformed
into hms(time) columns, which is usually sensible for averaging (default is
|
... |
Additional arguments passed to the metric function |
A dataframe with three rows representing average weekday, weekend, and mean daily values for the specified metric
# Calculate mean daily duration above threshold. As the data only contains
# data for two days, Weekend and Mean daily will throw NA
sample.data.irregular |>
aggregate_Datetime(unit = "1 min") |>
mean_daily_metric(
Variable = lux,
threshold = 100
)
# again with another dataset
sample.data.environment |>
mean_daily_metric(
Variable = MEDI,
threshold = 250)
# by default, datetime columns are converted to time
sample.data.environment |>
mean_daily_metric(
Variable = MEDI,
metric_type = timing_above_threshold,
threshold = 250)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.