assembleCodebook {redcapAPI}R Documentation

Assemble Codebook From the Data Dictionary

Description

This method enables the user to construct a code book similar in style to the REDCap project codebook. The codebook is similar in nature to the data dictionary, but multiple choice fields are represented with one line per coding.

Usage

assembleCodebook(
  rcon,
  fields = NULL,
  forms = NULL,
  drop_fields = NULL,
  field_types = NULL,
  include_form_complete = TRUE,
  expand_check = FALSE,
  ...
)

## S3 method for class 'redcapConnection'
assembleCodebook(
  rcon,
  fields = NULL,
  forms = NULL,
  drop_fields = NULL,
  field_types = NULL,
  include_form_complete = TRUE,
  expand_check = FALSE,
  ...
)

## S3 method for class 'redcapCodebook'
as.list(x, ...)

Arguments

rcon

A redcapConnection object.

fields

character or NULL. When character, the code book will be limited to the intersection of the fields designated by fields and forms. When NULL, all fields are included.

forms

character or NULL. When character, the code book will be limited to the intersection of the fields designated by fields and forms. When NULL, all forms are included.

drop_fields

character or NULL. When given, fields named will be removed from the code book.

field_types

character or NULL. When given, only the field types listed will be included in the code book. This will supercede the intersection of fields and forms. Matching of field types is performed against the values in the field_type column of the meta data.

include_form_complete

logical(1). When TRUE, the ⁠[form name]_complete⁠ fields will be included in the codebook.

expand_check

logical(1). When FALSE, the codebook for checkbox fields will be similar to the codebook for dropdown and radio fields, with one line per user-defined option. When TRUE, each checkbox option will be represented in two fields, one each for 0 (Unchecked) and 1 (Checked).

...

Arguments to pass to other methods

x

A redcapCodebook object as returned by assembleCodebook.

Value

Returns a redcapCodebook object. This inherits the data.frame class and has the columns

See Also

exportMetaData()

Examples

## Not run: 
unlockREDCap(connections = c(rcon = "project_alias"), 
             url = "your_redcap_url", 
             keyring = "API_KEYs", 
             envir = globalenv())
             
# codebook for the entire project
assembleCodebook(rcon)

# codebook for multiple choice fields
assembleCodebook(rcon, 
                 field_types = c("dropdown", "radio", "checkbox", 
                                 "yesno", "truefalse"))

## End(Not run)


[Package redcapAPI version 2.9.1 Index]