Creates zip-file with necessary content to manually add instrument to database
Source:R/export_redcap_instrument.R
export_redcap_instrument.Rd
Metadata can be added by editing the data dictionary of a project in the initial design phase. If you want to later add new instruments, this function can be used to create (an) instrument(s) to add to a project in production.
Examples
iris |>
ds2dd_detailed(
add.auto.id = TRUE,
form.name = sample(c("b", "c"), size = 6, replace = TRUE, prob = rep(.5, 2))
) |>
purrr::pluck("meta") |>
(\(.x){
split(.x, .x$form_name)
})() |>
purrr::imap(function(.x, .i){
export_redcap_instrument(.x,file=here::here(paste0(.i,Sys.Date(),".zip")))
})
#> A default id column has been added
#> Error in map2(.x, vec_index(.x), .f, ...): ℹ In index: 1.
#> ℹ With name: b.
#> Caused by error in `export_redcap_instrument()`:
#> ! could not find function "export_redcap_instrument"
iris |>
ds2dd_detailed(
add.auto.id = TRUE
) |>
purrr::pluck("meta") |>
export_redcap_instrument(file=here::here(paste0("instrument",Sys.Date(),".zip")))
#> Error in export_redcap_instrument(purrr::pluck(ds2dd_detailed(iris, add.auto.id = TRUE), "meta"), file = here::here(paste0("instrument", Sys.Date(), ".zip"))): could not find function "export_redcap_instrument"