rd_rlogic function

REDCap logic into R logic

REDCap logic into R logic

This function allows you to transcribe REDCap logic to R logic. WARNING: If the REDCap logic involves some smart-variables this function will not be able to transform it.

rd_rlogic(..., data = NULL, dic = NULL, event_form = NULL, logic, var)

Arguments

  • ...: List containing the data and the dictionary and the event if it's needed. Can be the output of the function redcap_data.
  • data: Data frame containing data from REDCap. If the list is specified this argument is not needed.
  • dic: Data frame containing the dictionary read from REDCap. If the list is specified this argument is not needed.
  • event_form: Data frame containing the correspondence of each event with each form. If the list is specified this argument is not needed.
  • logic: String containing a logic in REDCap format.
  • var: string with the name of the variable that contains the logic.

Returns

List containing the logic in R format and its evaluation.

Examples

rd_rlogic(covican, logic = "if([exc_1]='1' or [inc_1]='0' or [inc_2]='0' or [inc_3]='0',1,0)", var = "screening_fail_crit")