Skip to contents

This function is used to carry forward screening record as baseline record per subject id (RID) and study data collection phase (COLPROT).

Usage

adjust_scbl_record(
  .data,
  wide_format = TRUE,
  extra_id_cols = NULL,
  adjust_date_col = NULL,
  check_col = NULL
)

Arguments

.data

Data.frame

wide_format

A Boolean indicator of wide data format, Default: TRUE

extra_id_cols

ID variable names in addition to RID, COLPROT and VISCODE. Only applicable for a long format data.

adjust_date_col

Adjusting date column values. Only applicable if adjust_date_col is non-missing

check_col

Column name which values used to determine date column adjustment. Only applicable if adjust_date_col is non-missing

Value

A data.frame that contains adjusted baseline record and screening record.

Examples

if (FALSE) { # \dontrun{
pacc_mmse_long_file <- system.file(
  "/extradata/pacc-raw-input/pacc_mmse_long.csv",
  package = "ADNIMERGE2"
)
pacc_mmse_long <- readr::read_csv(
  file = pacc_mmse_long_file,
  guess_max = Inf
)
# For a wide format data
bl_sc_mmse_record <- adjust_scbl_record(
  .data = pacc_mmse_long %>%
    pivot_wider(names_from = SCORE_SOURCE, values_from = SCORE),
  wide_format = TRUE
)
head(bl_sc_mmse_record)

# For a long format data without adjusting for visit date
bl_sc_mmse_record_long <- adjust_scbl_record(
  .data = pacc_mmse_long,
  wide_format = FALSE,
  extra_id_cols = "SCORE_SOURCE"
)
head(bl_sc_mmse_record_long)

# For a long format data with adjusting for visit date
bl_sc_mmse_record_long <- adjust_scbl_record(
  .data = pacc_mmse_long,
  wide_format = FALSE,
  extra_id_cols = "SCORE_SOURCE",
  adjust_date_col = "VISDATE",
  check_col = "SCORE"
)
} # }