ctsit / redcapcustodian

Simplified, automated data management on REDCap systems
Other
13 stars 6 forks source link

Update Friday call demonstration #55

Closed ChemiKyle closed 2 years ago

ChemiKyle commented 2 years ago
ChemiKyle commented 2 years ago

The following is outdated, I've added data simulation fit to the main.xml file in commit 8f361e1


Here's a little snippet to simulate an arbitrary number of records, based on the "Basic Demography" project + a sample_collected_date field:

rows_to_simulate <- 1000

simulated_data <- data.frame(
  ## record_id = 1:rows_to_simulate,
  ethnicity = sample(c(0, 1, 2), rows_to_simulate, replace = T),
  race = sample(c(0, 1, 2), rows_to_simulate, replace = T),
  gender = sample(c(0, 1, 2, 3), rows_to_simulate, replace = T),
  sample_collected_date = sample(
    seq(ymd("2020-03-01"), ymd("2022-06-01"), by = "day"),
    rows_to_simulate, replace = T
  ),
  bmi = sample(
    seq(18, 30, 0.2), rows_to_simulate, replace = T
  )
) %>%
  arrange(sample_collected_date) %>%
  mutate(record_id = row_number())