redcap_metadata_write {REDCapR}R Documentation

Import metadata of a REDCap project

Description

Import metadata (i.e., data dictionary) into a project. Because of this method's destructive nature, it works for only projects in Development status.

Usage

redcap_metadata_write(
  ds,
  redcap_uri,
  token,
  verbose = TRUE,
  config_options = NULL
)

Arguments

ds

The base::data.frame() to be imported into the REDCap project. Required.

redcap_uri

The URI (uniform resource identifier) of the REDCap project. Required.

token

The user-specific string that serves as the password for a project. Required.

verbose

A boolean value indicating if messages should be printed to the R console during the operation. The verbose output might contain sensitive information (e.g. PHI), so turn this off if the output might be visible somewhere public. Optional.

config_options

A list of options to pass to httr::POST() method in the 'httr' package. See the details in redcap_read_oneshot() Optional.

Value

Currently, a list is returned with the following elements:

Author(s)

Will Beasley

References

The official documentation can be found on the 'API Help Page' and 'API Examples' pages on the REDCap wiki. If you do not have an account for the wiki, please ask your campus REDCap administrator to send you the static material.

Examples

## Not run: 
# Please don't run this example without changing the token to
# point to your server.  It could interfere with our testing suite.
uri            <- "https://bbmc.ouhsc.edu/redcap/api/"
token          <- "457C24AB91B7FCF5B1A7DA67E70E24C7"

# Read in the dictionary in R's memory from a csv file.
ds_to_write <-
  readr::read_csv(
    file = system.file(
      "test-data/project-simple/simple-metadata.csv",
      package = "REDCapR"
    ),
    col_types = readr::cols(.default = readr::col_character())
  )
ds_to_write

# Import the dictionary into the REDCap project
REDCapR::redcap_metadata_write(
  ds          = ds_to_write,
  redcap_uri  = uri,
  token       = token
)

## End(Not run)


[Package REDCapR version 1.1.0 Index]