# Calculate the duration of a dataset
durations(sample.data.environment)
# create artificial gaps in the data
gapped_data <-
sample.data.environment |>
dplyr::filter(MEDI >= 10) |>
gap_handler(full.days = TRUE)
#by default, the Datetime column is selected for the `Variable.colname`,
#basically ignoring NA measurement values
gapped_data |>
durations(count.NA = TRUE)
# Calculate the duration where MEDI are available
durations(gapped_data, MEDI)
# Calculate the duration, show the duration of NAs separately
durations(gapped_data, MEDI, show.missing = TRUE)
# Calculate the duration, show the dominant epoch
durations(gapped_data, Variable.colname = MEDI, show.interval = TRUE)
# Calculate durations for day and night separately
gapped_data |>
add_photoperiod(coordinates = c(48.52, 9.06)) |>
dplyr::group_by(photoperiod.state, .add = TRUE) |>
durations(Variable.colname = MEDI, show.interval = TRUE, show.missing = TRUE)
Run the code above in your browser using DataLab