xlit_angle: Phase angle of first/last timing above/below threshold.

xlit_angleR Documentation

Phase angle of first/last timing above/below threshold.

Description

These functions calculate the phase angle (i.e., timespan) between the first/last timepoint where light levels are above or below a given threshold intensity and the start/end of the given interval.

Usage

flit_angle(
  lightVar,
  timeVar,
  threshold,
  unit_out = "mins",
  as_df = TRUE,
  wide = TRUE
)

llit_angle(
  lightVar,
  timeVar,
  threshold,
  unit_out = "mins",
  as_df = TRUE,
  wide = TRUE
)

Arguments

lightVar

Numeric vector containing the light data.

timeVar

Vector containing the time data. Can be POSIXct or numeric.

threshold

Single numeric value or vector specifying threshold intensities. The sign indicates above/below (see threshold).

unit_out

String indicating the time unit of the output value. Possible values are ("seconds","minutes","hours","days"). Units can be abbreviated. Is only used if 'timeVar' is POSIXct, otherwise no conversion will be performed. Defaults to "minutes".

as_df

Logical. Should the output be returned as a data frame? Defaults to TRUE.

wide

Logical. Should the output be returned in wide format? Defaults to TRUE.

Details

The phase angle is relative to the start/end of the given time series. Therefore, a time interval of interest should be provided (e.g., the light exposure between waking up and going to bed).

'flit_angle()' calculates the phase angle between the first timing of light above/below threshold and the start of the given interval.

'llit_angle()' calculates the phase angle between the last timing of light above/below threshold and the end of the given interval.

Value

Data frame or matrix with pairs of threshold and calculated values. If 'wide' is TRUE then variable names will be concatenated with the threshold.


steffenhartmeyer/lightdosimetry documentation built on Jan. 29, 2024, 12:48 p.m.