constant: Collection of REDCap-specific constants

Description Usage Arguments Details Value Author(s) Examples

View source: R/constant.R

Description

Collection of constants defined by the REDCap developers.

Usage

1
constant(name, simplify = TRUE)

Arguments

name

Name of constant. Required character.

simplify

Simplifies the vector of values to a common data-type, if possible. Passed to the simplify parameter of base::sapply().

Details

Form Completeness

The current constants relate to the 'complete' variable at the end of each form.

Data Export Rights

See https://your-server/redcap/api/help/?content=exp_users.

Form Rights

See https://your-server/redcap/api/help/?content=exp_users. The order of these digits may be unexpected.

Access Rights

See https://your-server/redcap/api/help/?content=exp_users.

To add more, please for and edit constant.R on GitHub and submit a pull request. For instructions, please see Editing files in another user's repository in the GitHub documentation.

Value

The constant's value. Currently all are single integers, but that could be expanded in the future.

Author(s)

Will Beasley

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
REDCapR::constant("form_incomplete")  # Returns 0L
REDCapR::constant("form_unverified")  # Returns 1L
REDCapR::constant("form_complete"  )  # Returns 2L

REDCapR::constant("data_export_rights_no_access"   )  # Returns 0L
REDCapR::constant("data_export_rights_deidentified")  # Returns 1L
REDCapR::constant("data_export_rights_full"        )  # Returns 2L

REDCapR::constant("form_rights_no_access")  # Returns 0L
REDCapR::constant("form_rights_readonly" )  # Returns 1L
REDCapR::constant("form_rights_readwrite")  # Returns 2L

REDCapR::constant("access_no" )  # Returns 0L
REDCapR::constant("access_yes")  # Returns 1L

REDCapR::constant(c("form_complete", "form_complete", "form_incomplete")) # Returns c(2L, 2L, 0L)
REDCapR::constant(c(
  "form_rights_no_access",
  "form_rights_readonly",
  "form_rights_readwrite"
)) # Returns c(0L, 1L, 2L)

## Not run: 
# The following line returns an error:
#     Assertion on 'name' failed: Must be a subset of
#     {'form_complete','form_incomplete','form_unverified'},
#     but is {'bad-name'}.

REDCapR::constant("bad-name")    # Returns an error

REDCapR::constant(c("form_complete", "bad-name")) # Returns an error

## End(Not run)

OuhscBbmc/REDCapR documentation built on Sept. 28, 2018, 2:40 a.m.