rd_insert_na | R Documentation |
Function that allows you to manually input a missing to some variables ('vars') when some filters ('filter') are satisfied. Useful for checkboxes without a gatekeeper question in the branching logic. Take in account that the variable will be transformed only in the events where both the variable and the filter evaluation are present, so they need to have at least one event in common.
rd_insert_na(..., data = NULL, dic = NULL, event_form = NULL, vars, filter)
... |
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. |
vars |
Character vector containing the names of those variables to transform. |
filter |
Character vector containing the logic to be directly evaluated. When each logic is TRUE the corresponding variable specified in 'vars' will be put to missing. |
transformed data with the specified variables converted.
table(is.na(covican$data$potassium))
data <- rd_insert_na(covican,
vars = "potassium",
filter = "age < 65")
table(data$potassium)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.