REDCapCAST/data-raw/data-upload-examples.R

20 lines
507 B
R
Raw Normal View History

2024-02-27 13:20:21 +01:00
mtcars_redcap <- mtcars |>
dplyr::mutate(
record_id = seq_len(dplyr::n()),
name = rownames(mtcars)
) |>
dplyr::select(record_id, dplyr::everything())
2024-02-27 12:43:54 +01:00
mtcars_redcap |>
2024-02-27 13:20:21 +01:00
write.csv(here::here("data/mtcars_redcap.csv"), row.names = FALSE)
2024-02-27 12:43:54 +01:00
usethis::use_data(mtcars_redcap, overwrite = TRUE)
gtsummary::trial|>
dplyr::mutate(
record_id = dplyr::row_number()
) |>
dplyr::select(record_id, dplyr::everything())|>
write.csv(here::here("drafting/trials_redcap.csv"), row.names = FALSE)