validate: Inspect a 'base::data.frame()' to anticipate problems before...

Description Usage Arguments Details Value Author(s) References Examples

Description

This set of functions inspect a base::data.frame() to anticipate problems before writing with REDCap's API.

Usage

1
2
3
4
5
validate_for_write( d )

validate_no_logical( data_types, stop_on_error )

validate_field_names( field_names, stop_on_error )

Arguments

data_types

The data types of the base::data.frame() corresponding to the REDCap project.

stop_on_error

If TRUE, an error is thrown for violations. Otherwise, a dataset summarizing the problems is returned.

d

The base::data.frame() containing the dataset used to update the REDCap project.

field_names

The names of the fields/variables in the REDCap project.

Details

All functions listed in the Usage section above inspect a specific aspect of the dataset. The validate_for_write() function executes all these individual validation checks. It allows the client to check everything with one call.

Value

A tibble::tibble(), where each potential violation is a row. The two columns are:

Author(s)

Will Beasley

References

The official documentation can be found on the 'API Help Page' and 'API Examples' pages on the REDCap wiki (ie, https://community.projectredcap.org/articles/456/api-documentation.html and https://community.projectredcap.org/articles/462/api-examples.html). If you do not have an account for the wiki, please ask your campus REDCap administrator to send you the static material.

Examples

1
2
3
4
5
6
d <- data.frame(
  record_id      = 1:4,
  flag_logical   = c(TRUE, TRUE, FALSE, TRUE),
  flag_Uppercase = c(4, 6, 8, 2)
)
validate_for_write(d = d)

REDCapR documentation built on May 29, 2017, 9:24 a.m.