View source: R/response_rate.R
response_rate | R Documentation |
Calculate response rate
response_rate(
data,
valid_col,
participant_col,
time_col = NULL,
period_start = NULL,
period_end = NULL
)
data |
data frame with data |
valid_col |
name of the column that stores whether the beep was answered or not |
participant_col |
name of the column that stores the participant id (or equivalent) |
time_col |
optional: name of the column that stores the time of the beep, as a 'POSIXct' object. |
period_start |
string representing the starting date to
calculate response rates (optional). Accepts dates in the following
formats: |
period_end |
period end to calculate response rates (optional). |
a data frame with the response rate for each participant, and the number of beeps used to calculate the response rate
# Example 1: calculate response rates for the whole study
# Get example data
data(example_data)
# Calculate response rate for each participant
# We don't specify time_col, period_start or period_end.
# Response rates will be based on all the participant's data
response_rate <- response_rate(data = example_data,
valid_col = answered,
participant_col = participant)
# Example 2: calculate response rates for a specific time period
data(example_data)
# Calculate response rate for each participant between dates
response_rate <- response_rate(data = example_data,
valid_col = answered,
participant_col = participant,
time_col = sent,
period_start = '2024-05-15',
period_end = '2024-05-31')
# Get participants with a response rate below 0.5
response_rate[response_rate$response_rate < 0.5,]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.