Learn R Programming

LightLogR (version 0.10.0)

summary_table: Light exposure summary table helpers

Description

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.

Usage

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 )

Value

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.

Arguments

dataset

A data frame containing light logger data.

Variable.colname

Column containing light exposure values. Expects a symbol; defaults to MEDI for compatibility with the built-in datasets.

coordinates

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.

location

Optional location description (e.g. city name).

site

Optional site description (e.g. country or study site).

Datetime.colname

Column containing the timestamp information. Expects a symbol; defaults to Datetime.

Id.colname

Column containing the participant identifier. Expects a symbol; defaults to Id.

threshold.missing

Proportion of missing data (per participant-day) tolerated before a day is considered incomplete.

programmatic.use

Whether the function is used by another function. This determines the number of columns to be output. Default is FALSE

handle.gaps

Whether gaps in the data should be handled. Sets the argument in remove_partial_data(). Default is TRUE.

color

Color used for histogram accents in the metrics section.

Variable.label

Label used in the table footnote to describe the light variable.

histograms

Logical indicating whether histogram spark lines should be added for metrics where applicable.

Details

The function is used within summary_table().

Examples

Run this code
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