Learn R Programming

redcapAPI (version 2.10.0)

splitForms: Split a Data Frame into its Forms

Description

Separates a data frame from REDCap into a list of data frames where each form constitutes an element in the list.

Usage

splitForms(Records, rcon, envir = NULL, base = NULL, post = NULL)

Arguments

Records

data.frame such as one generated by exportRecords or exportRecordsTyped

rcon

A redcapConnection object.

envir

environment. The target environment for the resulting list of data.frames. Defaults to NULL which returns the a list. Use globalenv to assign the global environment. Will accept a number of the environment.

base

character(1) giving the start of the naming scheme for the elements of the list. By default, the names of the list will be the form names. If this value is provided, it will follow the format base.form_name.

post

function to apply to each element of form data after separating them, must be of signature function(data, rcon).

See Also

Other post-processing functions

recastRecords(),
guessCast(),
guessDate(),
castForImport(),
mChoiceCast(),
widerRepeated()

Examples

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

splitForms(Records, rcon)
}
   
  

Run the code above in your browser using DataLab