prepUserImportData: Prepare User Data for Import

View source: R/prepUserImportData.R

prepUserImportDataR Documentation

Prepare User Data for Import

Description

Prepares a data frame for import via the API. Allows for data to be passed in either the raw format or the labeled data received from exportUsers.

Usage

prepUserImportData(data, rcon, consolidate = TRUE, user_role = FALSE)

Arguments

data

data.frame with the structure of redcapAPI:::REDCAP_USER_STRUCTURE. It may also have additional columns for the form and export access of each of the instruments.

rcon

A redcapConnection object.

consolidate

logical(1) If TRUE, the form and data export access values will be read from the expanded columns. Otherwise, the consolidated values (as provided by the API export) are utilized.

user_role

logical(1) If TRUE, the code will treat the data as if it is being prepared for importing User Roles.

Value

Returns a data.frame with user settings that will be accepted by the API for import.

See Also

importUsers(),
importUserRoles()

Examples

## Not run: 
unlockREDCap(connections = c(rcon = "project_alias"), 
             url = "your_redcap_url", 
             keyring = "API_KEYs", 
             envir = globalenv())


# Prep user data
NewData <- data.frame(username = "target_user", 
                      design = 1, 
                      api_export = "Access", 
                      api_import = "No Access", 
                      surveys_enabled = 0)
prepUserImportData(data = NewData, 
                   rcon = rcon)
                   
# Prep user role data
NewData <- data.frame(unique_role_name = "target_user", 
                      design = 1, 
                      api_export = "Access", 
                      api_import = "No Access", 
                      surveys_enabled = 0)
prepUserImportData(data = NewData, 
                   rcon = rcon)

## End(Not run)


redcapAPI documentation built on Sept. 13, 2023, 1:07 a.m.