Skip to contents

Compute cycledays and phases from dates and provided starts of cycles.

Usage

.compute_phase_and_cycleday(data, sep_event)

Arguments

data

a data.frame that contains symptoms reported subjects. The data must be in a long format and have the following columns: subject, item, drsp_score

sep_event

a character XXX

Value

the same data.frame as data with additional columns.

Examples

random_data =
    expand.grid(
        subject = 1,
        item = 1:24,
        date = seq(as.Date("2020-01-01"), as.Date("2020-03-01"), by = 1)
        )
random_data$drsp_score <- sample(1:6, nrow(random_data), replace = TRUE)
random_data$is_cycle_start <-
    ifelse(
       random_data$date %in%
         c(as.Date("2020-01-15"), as.Date("2020-02-20")),
       TRUE, FALSE)
# augmented_data <- .compute_phase_and_cycleday(random_data, sep_event = "ovulation")
# colnames(augmented_data)