Brown2reference {LightLogR}R Documentation

Add Brown et al. (2022) reference illuminance to a dataset

Description

Adds several columns to a light logger dataset. It requires a column that contains the Brown states, e.g. "daytime", "evening", and "night". From that the function will add a column with the recommended illuminance, a column that checks if the illuminance of the dataset is within the recommended illuminance levels, and a column that gives a label to the reference.

Usage

Brown2reference(
  dataset,
  MEDI.colname = MEDI,
  Brown.state.colname = State.Brown,
  Brown.rec.colname = Reference,
  Reference.label = "Brown et al. (2022)",
  overwrite = FALSE,
  ...
)

Arguments

dataset

A dataframe that contains a column with the Brown states

MEDI.colname

The name of the column that contains the MEDI values which are used for checks against the Brown reference illuminance. Must be part of the dataset.

Brown.state.colname

The name of the column that contains the Brown states. Must be part of the dataset.

Brown.rec.colname

The name of the column that will contain the recommended illuminance. Must not be part of the dataset, otherwise it will throw an error.

Reference.label

The label that will be used for the reference. Expects a character scalar.

overwrite

If TRUE (defaults to FALSE), the function will overwrite the Brown.rec.colname column if it already exists.

...

Additional arguments that will be passed to Brown_rec() and Brown_check(). This is only relevant to correct the names of the daytime states or the thresholds used within these states. See the documentation of these functions for more information.

Details

On a lower level, the function uses Brown_rec() and Brown_check() to create the required information.

Value

A dataframe on the basis of the dataset that contains the added columns.

References

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

See Also

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

Examples

#add Brown reference illuminance to some sample data
testdata <- tibble::tibble(MEDI = c(100, 10, 1, 300),
                  State.Brown = c("day", "evening", "night", "day"))
Brown2reference(testdata)


[Package LightLogR version 0.3.8 Index]