This function checks if the data can be used by the CPASS functions and transforms it into a "cpass" data.frame.

as_cpass_data(data, sep_event = NULL, silent = FALSE, verbose = TRUE)

Arguments

data

a data.frame that contains symptoms reported subjects. The data must be in a long format, _i.e._ one row per subject, day (date or cycle + cycleday) and DRSP item. The data.frame must have the following columns: subject, item, drsp_score as well as two columns defining time. These two columns can be cycle + day, date + is_cycle_start, or date + bleeding. See supported_data_format for details.

sep_event

(required) character ("menses" or "ovulation") specifying whether the menstrual event separating the two phases of interest (the "pre" and "post" weeks) is the menses or ovulation. If the menses is the separating event, the week preceding the menstruation ("pre") is compared to the week following the menstruation ("post"). In that case, the "pre" and the "post" week do NOT belong to the same cycle. If ovulation is the separating event, then the two phases belong to the same cycle.

silent

(optional) logical, default = FALSE. Should warning messages be printed?

verbose

(optional) logical. Should the function print additional information? (mostly used for debugging purposes)

Value

a data.frame.

Examples

random_data =
   expand.grid(
       subject = 1,
       cycle = 1:2,
       day = c(1:10,-10:-1),
       item = 1:24
       )
random_data$drsp_score = sample(1:6, nrow(random_data), replace = TRUE)
cpass_data = as_cpass_data(random_data, sep_event = "menses")
#> Number of subjects:  1 
#> Total number of cycles:  2 
#> Percentage of missing scores:  0 %
#> Percentage of missing scores
#>           (in pre- & post-menstrual phases):  0 %
colnames(cpass_data)
#> [1] "subject"    "cycle"      "phase"      "day"        "item"      
#> [6] "drsp_score"