When working with a longitudinal REDCap project, the exported data has a structure where each row represents one event per record. However, by default REDCap does not export events for which there is no information available. This function allows you to identify which records do not contain information about a particular event.
Usage
rd_event(
...,
data = NULL,
dic = NULL,
event,
filter = NA,
query_name = NA,
addTo = NA,
report_title = NA,
report_zeros = FALSE,
link = list()
)
Arguments
- ...
List containing the data, dictionary and event mapping (if required) of the REDCap project. This should be the output of the `redcap_data` function.
- data
Data frame containing the data read from REDCap. If the list is specified, this argument is not required.
- dic
Data frame containing the dictionary read from REDCap. If the list is specified, this argument is not required.
- event
Character vector with the name of the REDCap event(s) to be analyzed.
- filter
A filter to be applied to the dataset. This argument can be used to identify the missing events on a subset of the dataset.
- query_name
Description of the query. It can be the same for all variables, or you can define a different one for each variable. By default, the function defines it as `The event [event] is missing' for each event`.
- addTo
Data frame corresponding to a previous query data frame to which you can add the new query data frame. By default, the function always generates a new data frame without taking into account previous reports.
- report_title
Character string specifying the title of the report.
- report_zeros
Logical. If `TRUE`, the function returns a report containing variables with zero queries.
- link
List of project information used to create a web link for each missing event.
Value
A list with a data frame of 9 columns (10 columns if the link argument is specified) to help the user identify each missing event and a table with the total number of missing events per event analyzed.
Examples
example <- rd_event(covican,
event = "follow_up_visit_da_arm_1")
example
#> $queries
#> Identifier DAG Event Instrument Field Repetition
#> 1 101-36 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 2 102-6 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 3 102-10 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 4 102-13 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 5 102-23 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 6 102-27 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 7 102-30 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 8 102-39 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 9 102-48 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 10 102-60 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 11 102-64 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 12 102-73 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 13 102-74 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 14 102-75 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 15 102-83 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 16 102-84 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 17 102-103 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 18 102-104 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 19 102-113 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 20 102-127 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 21 102-134 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 22 105-11 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 23 105-56 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 24 106-15 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 25 106-29 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 26 106-32 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 27 108-29 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 28 109-10 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 29 109-22 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 30 109-34 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 31 112-7 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 32 117-11 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 33 117-22 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 34 118-7 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 35 118-12 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 36 119-14 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 37 120-10 Hospital 1 follow_up_visit_da_arm_1 - - -
#> 38 120-26 Hospital 1 follow_up_visit_da_arm_1 - - -
#> Description
#> 1 Follow up visit day 14+/-5d
#> 2 Follow up visit day 14+/-5d
#> 3 Follow up visit day 14+/-5d
#> 4 Follow up visit day 14+/-5d
#> 5 Follow up visit day 14+/-5d
#> 6 Follow up visit day 14+/-5d
#> 7 Follow up visit day 14+/-5d
#> 8 Follow up visit day 14+/-5d
#> 9 Follow up visit day 14+/-5d
#> 10 Follow up visit day 14+/-5d
#> 11 Follow up visit day 14+/-5d
#> 12 Follow up visit day 14+/-5d
#> 13 Follow up visit day 14+/-5d
#> 14 Follow up visit day 14+/-5d
#> 15 Follow up visit day 14+/-5d
#> 16 Follow up visit day 14+/-5d
#> 17 Follow up visit day 14+/-5d
#> 18 Follow up visit day 14+/-5d
#> 19 Follow up visit day 14+/-5d
#> 20 Follow up visit day 14+/-5d
#> 21 Follow up visit day 14+/-5d
#> 22 Follow up visit day 14+/-5d
#> 23 Follow up visit day 14+/-5d
#> 24 Follow up visit day 14+/-5d
#> 25 Follow up visit day 14+/-5d
#> 26 Follow up visit day 14+/-5d
#> 27 Follow up visit day 14+/-5d
#> 28 Follow up visit day 14+/-5d
#> 29 Follow up visit day 14+/-5d
#> 30 Follow up visit day 14+/-5d
#> 31 Follow up visit day 14+/-5d
#> 32 Follow up visit day 14+/-5d
#> 33 Follow up visit day 14+/-5d
#> 34 Follow up visit day 14+/-5d
#> 35 Follow up visit day 14+/-5d
#> 36 Follow up visit day 14+/-5d
#> 37 Follow up visit day 14+/-5d
#> 38 Follow up visit day 14+/-5d
#> Query Code
#> 1 The event 'Follow up visit day 14+/-5d' is missing. 101-36-1
#> 2 The event 'Follow up visit day 14+/-5d' is missing. 102-6-1
#> 3 The event 'Follow up visit day 14+/-5d' is missing. 102-10-1
#> 4 The event 'Follow up visit day 14+/-5d' is missing. 102-13-1
#> 5 The event 'Follow up visit day 14+/-5d' is missing. 102-23-1
#> 6 The event 'Follow up visit day 14+/-5d' is missing. 102-27-1
#> 7 The event 'Follow up visit day 14+/-5d' is missing. 102-30-1
#> 8 The event 'Follow up visit day 14+/-5d' is missing. 102-39-1
#> 9 The event 'Follow up visit day 14+/-5d' is missing. 102-48-1
#> 10 The event 'Follow up visit day 14+/-5d' is missing. 102-60-1
#> 11 The event 'Follow up visit day 14+/-5d' is missing. 102-64-1
#> 12 The event 'Follow up visit day 14+/-5d' is missing. 102-73-1
#> 13 The event 'Follow up visit day 14+/-5d' is missing. 102-74-1
#> 14 The event 'Follow up visit day 14+/-5d' is missing. 102-75-1
#> 15 The event 'Follow up visit day 14+/-5d' is missing. 102-83-1
#> 16 The event 'Follow up visit day 14+/-5d' is missing. 102-84-1
#> 17 The event 'Follow up visit day 14+/-5d' is missing. 102-103-1
#> 18 The event 'Follow up visit day 14+/-5d' is missing. 102-104-1
#> 19 The event 'Follow up visit day 14+/-5d' is missing. 102-113-1
#> 20 The event 'Follow up visit day 14+/-5d' is missing. 102-127-1
#> 21 The event 'Follow up visit day 14+/-5d' is missing. 102-134-1
#> 22 The event 'Follow up visit day 14+/-5d' is missing. 105-11-1
#> 23 The event 'Follow up visit day 14+/-5d' is missing. 105-56-1
#> 24 The event 'Follow up visit day 14+/-5d' is missing. 106-15-1
#> 25 The event 'Follow up visit day 14+/-5d' is missing. 106-29-1
#> 26 The event 'Follow up visit day 14+/-5d' is missing. 106-32-1
#> 27 The event 'Follow up visit day 14+/-5d' is missing. 108-29-1
#> 28 The event 'Follow up visit day 14+/-5d' is missing. 109-10-1
#> 29 The event 'Follow up visit day 14+/-5d' is missing. 109-22-1
#> 30 The event 'Follow up visit day 14+/-5d' is missing. 109-34-1
#> 31 The event 'Follow up visit day 14+/-5d' is missing. 112-7-1
#> 32 The event 'Follow up visit day 14+/-5d' is missing. 117-11-1
#> 33 The event 'Follow up visit day 14+/-5d' is missing. 117-22-1
#> 34 The event 'Follow up visit day 14+/-5d' is missing. 118-7-1
#> 35 The event 'Follow up visit day 14+/-5d' is missing. 118-12-1
#> 36 The event 'Follow up visit day 14+/-5d' is missing. 119-14-1
#> 37 The event 'Follow up visit day 14+/-5d' is missing. 120-10-1
#> 38 The event 'Follow up visit day 14+/-5d' is missing. 120-26-1
#>
#> $results
#> <table class="table table-striped table-condensed" style="width: auto !important; margin-left: auto; margin-right: auto;">
#> <caption>Report of queries</caption>
#> <thead>
#> <tr>
#> <th style="text-align:center;border-bottom: 1px solid grey"> Events </th>
#> <th style="text-align:center;border-bottom: 1px solid grey"> Description </th>
#> <th style="text-align:center;border-bottom: 1px solid grey"> Total </th>
#> </tr>
#> </thead>
#> <tbody>
#> <tr>
#> <td style="text-align:center;"> follow_up_visit_da_arm_1 </td>
#> <td style="text-align:center;"> Follow up visit day 14+/-5d </td>
#> <td style="text-align:center;"> 38 </td>
#> </tr>
#> </tbody>
#> </table>