
Create a state column that cuts light levels into sections by Brown et al. (2022)
Source:R/Brown.R
Brown_cut.Rd
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
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
Vecotr of labels for the cuts. Must be one entry shorter than
vector_cuts
.- overwrite
Logical. Should the
New.state.colname
overwrite a preexisting column in the dataset
See also
Other Brown:
Brown2reference()
,
Brown_check()
,
Brown_rec()
,
sleep_int2Brown()
Examples
sample.data.environment |>
Brown_cut() |>
dplyr::count(state)
#> # A tibble: 8 × 3
#> # Groups: Id [2]
#> Id state n
#> <fct> <fct> <int>
#> 1 Environment ≤1lx 6768
#> 2 Environment ≤10lx 247
#> 3 Environment NA 523
#> 4 Environment ≥250lx 9742
#> 5 Participant ≤1lx 20315
#> 6 Participant ≤10lx 5781
#> 7 Participant NA 15892
#> 8 Participant ≥250lx 9852