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.
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.
Returns
Returns a redcapCodebook object. This inherits the data.frame class and has the columns
field_name - The name of the field.
form - The name of the form on which the field is located.
field_type - The field type.
code - For multiple choice fields, the coding for the option.
label - For multiple choice fields, the label for the option.
min - For date and numeric fields, the minimum value in the validation, if any.
max - For date and numeric fields, the maximum value in the validation, if any.
branching_logic - For fields with branching logic, the string denoting the logic applied.
field_order - The numeric order of the field in the data dictionary.
form_order - The numeric order of the form in the data dictionary.
Examples
## Not run:unlockREDCap(connections = c(rcon ="project_alias"), url ="your_redcap_url", keyring ="API_KEYs", envir = globalenv())# codebook for the entire projectassembleCodebook(rcon)# codebook for multiple choice fieldsassembleCodebook(rcon, field_types = c("dropdown","radio","checkbox","yesno","truefalse"))## End(Not run)