Brown_cut: Create a state column that cuts light levels into sections by...

View source: R/Brown.R

Brown_cutR Documentation

Create a state column that cuts light levels into sections by Brown et al. (2022)

Description

This is a convenience wrapper arount cut() and dplyr::mutate(). It creates a state column dividing a light column into recommended levels by Brown et al. (2022). Cuts can be adjusted or extended with vector_cuts and vector_labels

Usage

Brown_cut(
  dataset,
  MEDI.colname = MEDI,
  New.state.colname = state,
  vector_cuts = c(-Inf, 1, 10, 250, Inf),
  vector_labels = "default",
  overwrite = TRUE
)

Arguments

dataset

A light exposure dataframe

MEDI.colname

The colname containing melanopic EDI values (or, alternatively, Illuminance). Defaults to MEDI. Expects a symbol.

New.state.colname

Name of the new column that will contain the cut data. Expects a symbol.

vector_cuts

Numeric vector of breaks for the cuts.

vector_labels

Vector of labels for the cuts. Must be one entry shorter than vector_cuts. "default" will produce nice labels for the default setting of vector_cuts (and throw an error otherwise).

overwrite

Logical. Should the New.state.colname overwrite a preexisting column in the dataset

Value

The input dataset with an additional (or overwritten) column containing a cut light vector

References

https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.3001571

See Also

Other Brown: Brown2reference(), Brown_check(), Brown_rec(), sleep_int2Brown()

Examples

sample.data.environment |>
Brown_cut(vector_labels = c("0-1lx", "1-10lx", "10-250lx", "250lx-Inf")) |>
dplyr::count(state)


LightLogR documentation built on June 10, 2025, 5:12 p.m.