cleans longitudinal data. similar to collapse_df_reps(method = "clean") except that zscores below clean_thresh (z_thresh) but above a lower threshold (z_thresh_2) are sitll counted if a previous sample from that person scored above z_thresh.

zclean_longitudinal(
  z_min,
  z_mean,
  sample_list,
  z_thresh = 3.5,
  z_thresh2 = 2,
  show_progress = TRUE
)

Arguments

z_min

minimum zscore from collapse_df_reps(method = "min")

z_mean

mean zscore from collapse_df_reps(method = "mean")

sample_list

named list. each list element name is patient ID (e.g. 123456). Each list element containcs a character vector of patient+timepoint labels in order. (e.g. 123456_t1, 123456_t2, 123456_t3).

z_thresh

if z > z_thresh, take mean

z_thresh2

if z_thresh2 < z < z_thresh, take mean if previous timepoint z > z_thresh, otherwise set to zero. If z < z_thresh, set to zero.

show_progress

logical indicating whether or not to show progress bar