Learn R Programming

redcapAPI (version 2.8.0)

dagMethods: Export, Import, Delete Data Access Groups from a Project

Description

These methods enable the user to export existing Data Access Groups, import new Data Access Groups, or delete Data Access Groups from a project.

Usage

exportDags(rcon, ...)

importDags(rcon, data, ...)

deleteDags(rcon, dags, ...)

# S3 method for redcapApiConnection exportDags( rcon, ..., error_handling = getOption("redcap_error_handling"), config = list(), api_param = list() )

# S3 method for redcapApiConnection importDags( rcon, data, refresh = TRUE, ..., error_handling = getOption("redcap_error_handling"), config = list(), api_param = list() )

# S3 method for redcapApiConnection deleteDags( rcon, dags, refresh = TRUE, ..., error_handling = getOption("redcap_error_handling"), config = list(), api_param = list() )

Value

exportDags with the columns

data_access_group_nameThe human readable name for the data access group.
unique_group_nameThe internal unique group name.
data_access_group_idThe internal numeric identifier.

importDags has no return, but will print a message indicating the number of Data Access Groups imported.

deleteDags has no return, but will print a message indicating the number of Data Access Groups deleted.

Arguments

rcon

A redcapConnection object.

dags

character vector of names matching the unique_group_name.

data

A data.frame with two columns: data_access_group_name and unique_group_name.

refresh

logical(1). When TRUE, cached data access group data will be refreshed after the import.

...

Arguments to pass to other methods

error_handling

character(1). One of c("error", "null"). An option for how to handle errors returned by the API. see redcapError().

config

A named list. Additional configuration parameters to pass to httr::POST(). These are appended to any parameters in rcon$config.

api_param

A named list. Additional API parameters to pass into the body of the API call. This provides users to execute calls with options that may not otherwise be supported by redcapAPI.

Functions

  • exportDags(): Export Data Access Groups from a REDCap Project

  • importDags(): Import Data Access Groups to a project.

  • deleteDags(): Delete Data Access Groups from a project.

Details

To import new data access groups, the user must provide a value for data_access_group_name with no value (NA) for unique_group_name.

To modify a group name, provide a new value for data_access_group_name with the associated unique_group_name. If unique_group_name is provided, it must match a value currently in the project.

See Also

switchDag(),
exportUserDagAssignments(),
importUserDagAssignments()

Examples

Run this code
if (FALSE) {
unlockREDCap(connections = c(rcon = "project_alias"), 
             url = "your_redcap_url", 
             keyring = "API_KEYs", 
             envir = globalenv())

exportDags(rcon)


# Import a new Data Access Group
NewData <- data.frame(data_access_group_name = "New DAG Name", 
                      unique_group_name = NA_character_)
importDags(rcon, 
           data = NewData)
           
# Modify an existing Data Access Group Name
# The user will need to match the unique_group_name to the existing DAGs
ChangeData <- data.frame(data_access_group_name = "Altered DAG Name", 
                         unique_group_name = "new_dag_name")
importDags(rcon, 
           data = ChangeData)
           
# Delete a Data Access Group
deleteDags(rcon, 
           dags = c("new_dag_name"))
}

Run the code above in your browser using DataLab