recalculate function

Recalculate REDCap calculated fields

Recalculate REDCap calculated fields

Function that recalculates every calculated field if the logic can be transcribed to R. Recall that calculated fields with smart-variables in the logic or variables in other events cannot be transcribed.

The function will return the dataset and dictionary with the added recalculated variables (the name of the calculated field + _recalc) along with a table that shows the summary of the results.

recalculate(data, dic, event_form = NULL, exclude_recalc = NULL)

Arguments

  • data: Data frame containing data from REDCap.
  • dic: Data frame containing the dictionary read from REDCap.
  • event_form: Data frame containing the correspondence of each event with each form.
  • exclude_recalc: Character vector with the names of the variables that do not have to be recalculated. Might be useful for projects were there are some calculated fields that have a time consuming recalculation.