These helpers create a publication-ready summary table for light logger datasets. Users can either calculate the metrics, generate overview counts, or render the complete gt table.
This function creates a tibble that gives some high level information about a dataset: How many participants are in there, the number of participant days, how many participant days are complete above a given threshold, how much data is missing, and (if provided) what the photoperiod is.
summary_overview(
dataset,
Variable.colname = MEDI,
coordinates = NULL,
location = NULL,
site = NULL,
Datetime.colname = Datetime,
Id.colname = Id,
threshold.missing = 0.2,
programmatic.use = FALSE,
handle.gaps = TRUE
)summary_metrics(
dataset,
Variable.colname = MEDI,
Datetime.colname = Datetime,
Id.colname = Id,
threshold.missing = 0.2,
programmatic.use = FALSE,
handle.gaps = TRUE
)
summary_table(
dataset,
coordinates = NULL,
location = NULL,
site = NULL,
color = "grey",
Variable.colname = MEDI,
Datetime.colname = Datetime,
Id.colname = Id,
threshold.missing = 0.2,
Variable.label = "melanopic EDI (lx)",
histograms = TRUE
)
A tibble with overview metrics (type, name, mean, SD, min,
max, plot). A location_string attribute is attached to the result for
use in summary_table(). If programmatic.use = FALSE, type, SD and
plot are removed.
A tibble with summarized metrics across participant-days and
participant-level stability measures. Columns are compatible with
summary_table().
A gt table.
A data frame containing light logger data.
Column containing light exposure values. Expects a
symbol; defaults to MEDI for compatibility with the built-in datasets.
Optional numeric vector of length two containing latitude
and longitude (in that order). If supplied, photoperiod information is
calculated when the dataset does not already contain a photoperiod
column.
Optional location description (e.g. city name).
Optional site description (e.g. country or study site).
Column containing the timestamp information. Expects
a symbol; defaults to Datetime.
Column containing the participant identifier. Expects a
symbol; defaults to Id.
Proportion of missing data (per participant-day) tolerated before a day is considered incomplete.
Whether the function is used by another function.
This determines the number of columns to be output. Default is FALSE
Whether gaps in the data should be handled. Sets the
argument in remove_partial_data(). Default is TRUE.
Color used for histogram accents in the metrics section.
Label used in the table footnote to describe the light variable.
Logical indicating whether histogram spark lines should be added for metrics where applicable.
The function is used within summary_table().
sample.data.environment |> summary_overview()
sample.data.irregular |> summary_overview()
# \donttest{
sample.data.environment |>
filter_Date(length = "3 days") |>
summary_metrics()
# }
#sample.data.environment |> summary_table(coordinates = c(47,9))
Run the code above in your browser using DataLab