This function cleans and filters survey response data based on a variety of user-specified criteria. This includes filtering based on distribution channel, progress threshold, and response date.
Usage
clean_answers(
data,
apply_channel_filter = TRUE,
channel_keep = "anonymous",
apply_progress_filter = TRUE,
progress_threshold = 60,
apply_date_filter = TRUE,
date_variable = "StartDate",
date_filter = c(year = 2023, month = NULL, day = NULL)
)
Arguments
- data
A data.frame containing the survey response data.
- apply_channel_filter
Logical; if TRUE, filter responses based on distribution channel.
- channel_keep
The name of the distribution channel to keep. Responses from other channels are excluded.
- apply_progress_filter
Logical; if TRUE, filter responses based on progress threshold.
- progress_threshold
The minimum required progress for a response to be included in the cleaned data.
- apply_date_filter
Logical; if TRUE, filter responses based on response date.
- date_variable
The name of the column in the data.frame containing response dates.
- date_filter
A list specifying the earliest date (year, month, day) to include in the cleaned data.
Examples
if (FALSE) {
cleaned_data <- clean_answers(data = survey_data,
apply_channel_filter = TRUE,
channel_keep = "anonymous",
apply_progress_filter = TRUE,
progress_threshold = 60,
apply_date_filter = TRUE,
date_variable = "StartDate",
date_filter = c(year = 2023, month = NULL, day = NULL))
}