data-raw/crcscreen.R

### 'crcscreen' from Prevost et al, 1998 (Am J Epidemiol)
# https://www.ncbi.nlm.nih.gov/pubmed/9753016
crcscreen <- data.frame(matrix(c(
  # ageD , group, r, py
  1, 1, 249, 799303,
  2, 1, 612, 747773,
  3, 1, 842, 531858,
  4, 1, NA, NA,
  1, 2, 12, 25041,
  2, 2, 35, 24933,
  3, 2, 84, 19836,
  4, 2, 0, 1497,
  1, 3, 4, 24545,
  2, 3, 16, 24211,
  3, 3, 24, 19068,
  4, 3, NA, NA,
  1, 4, 3, 22568,
  2, 4, 7, 22456,
  3, 4, 19, 19068,
  4, 4, NA, NA,
  1, 5, 2, 14314,
  2, 5, 8, 14494,
  3, 5, 12, 11045,
  4, 5, NA, NA
),
byrow = T, ncol = 4
), stringsAsFactors = FALSE)
names(crcscreen) <- c("ageD", "group", "r", "py")
crcscreen$ageD <- factor(crcscreen$ageD, levels = seq(4), labels = c("45-54", "55-64", "65-74", "Unknown"))
crcscreen$group <- factor(crcscreen$group, levels = seq(5), labels = c("Controls", "At screening", "First year after screening", "Second year after screening", "Third year after screening"))
crcscreen$t <- vapply(
  X = crcscreen$group,
  FUN = function(w) {
    switch(w,
      "Controls" = NA,
      "At screening" = 0,
      "First year after screening" = 1,
      "Second year after screening" = 2,
      "Third year after screening" = 3
    )
  },
  FUN.VALUE = numeric(1)
)

usethis::use_data(crcscreen, overwrite = TRUE)
ellessenne/random documentation built on Nov. 4, 2019, 11:52 a.m.