build_r_data_package: Build R Data Package

Description Usage Arguments Details Examples

View source: R/build_r_data_package.R

Description

Build a R Data Package from the core contents of a REDCap Project.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
build_r_data_package(x, ...)

## S3 method for class 'rcer_rccore'
build_r_data_package(x, path = NULL, author_roles = NULL, verbose = TRUE, ...)

## Default S3 method:
build_r_data_package(
  x,
  uri = NULL,
  token = NULL,
  format = NULL,
  path = NULL,
  author_roles = NULL,
  verbose = TRUE,
  ...
)

Arguments

x

a rcer_rccore object

...

arguments passed to other methods

path

Path where the exported project source will be created/overwritten.

author_roles

a list naming specific roles for each user id found in the user table from an exported project. By default all users with be contributors ('ctb'). You will need to define a author/creator.

verbose

provide messages to tell the user what is happening

uri

The URI for the REDCap API. If NULL (default) the value Sys.getenv("REDCap_API_URI") is used.

token

The API token for the project you want to export from. If NULL (default) the value Sys.getenv("REDCap_API_TOKEN") is used.

format

The format to return. If NULL (default) the value Sys.getenv("REDCap_API_format") is used.

Details

To export the data from a REDCap project you will need to have an API Token. Remember, the token is the equivalent of a username and password. As such you should not list the token in plan text. Several alternative methods for passing the token to this method will be provided in examples and vignettes. We strongly encourage the use of the package secret https://cran.r-project.org/package=secret to build vaults to store tokens locally.

The initial export will consist of four pieces of data, the user data, metadata, project info, and records.

Examples

1
2
3
4
5
6
7
8
9
## Please read the vignette for examples:
## vignette(topic = "export", package = "REDCapExporter")

library(REDCapExporter)
# avs_raw_core <- export_core()
data(avs_raw_core)
tmppth <- tempdir()
build_r_data_package(avs_raw_core, tmppth, author_roles = list(dewittp = c("cre", "aut")))
fs::dir_tree(tmppth)

REDCapExporter documentation built on Feb. 2, 2021, 5:15 p.m.