drop_detect {dropout} | R Documentation |
Detecting Dropouts in Surveys
Description
drop_detect
function detects participants who have dropped out of a survey.
It identifies sequences of NA values up to the last survey question and pinpoints the column where the dropout occurred.
It also provides the index of that column, enabling targeted analysis of dropout patterns.
Usage
drop_detect(data, last_col = NULL)
Arguments
data |
A dataframe or tibble containing the survey data. |
last_col |
The index position or column name of the last survey item. This is optional and is used when there are additional columns in the data frame that are not part of the survey questions you are interested in. |
Value
A dataframe or tibble where each row corresponds to a row in the original dataset. It contains three columns:
-
dropout
: A logical indicating whether a dropout was detected for this row. -
dropout_column
: Ifdropout
is TRUE, the name of the column where the dropout occurred. -
dropout_index
: Ifdropout
is TRUE, the index (column number) where the dropout occurred.
See Also
See vignette for detailed workflows and practical examples.
Examples
# Basic usage
drop_detect(flying, "location_census_region")