Package 'dropout'

Title: Handling Incomplete Responses in Survey Data Analysis
Description: Offers robust tools to identify and manage incomplete responses in survey datasets, thereby enhancing the quality and reliability of research findings.
Authors: Hendrik Mann [aut, cre]
Maintainer: Hendrik Mann <[email protected]>
License: MIT + file LICENSE
Version: 2.2.1
Built: 2025-02-12 04:10:30 UTC
Source: https://github.com/hendr1km/dropout

Help Index


Detect Instances of Dropout in Data

Description

The drop_detect function detects participants who drop out of the survey by recognizing NA sequences up to the last question of the survey. Additionally, the function provides the column name and index where the dropout occurs.

Usage

drop_detect(data)

Arguments

data

A dataframe in which to detect instances of dropout.

Value

A dataframe containing the following columns:

  • drop: A logical value indicating whether dropout has occurred (TRUE for dropout, FALSE otherwise).

  • drop_index: The index of the column where dropout occurred (NA if no dropout).

  • column: The name of the column where the dropout occurred (⁠<NA>⁠ if no dropout).

Examples

## Not run: 
# Example usage with the 'flying' dataframe
detect_result <- drop_detect(flying)
print(detect_result)

## End(Not run)

Summarize Missing Data Metrics for Each Column

Description

The drop_summary function generates a summary of missing data (NA values) for each column in a dataframe. It computes various metrics such as the number of dropout participants, section NAs, the mode length of those missing value sections for, and the proportion of complete cases for each column.

Usage

drop_summary(data)

Arguments

data

A dataframe for which to analyze missing data.

Details

The function calls a C API to compute some metrics, which are then processed and returned as a summary dataframe.

Value

A dataframe containing the following columns:

  • column: The name of each column in the input dataframe.

  • drop: The number of dropped rows (missing values) for that column.

  • sec_na: The number of sections of consecutive NAs for that column.

  • sec_length: The mode (most frequent length) of sections of consecutive NAs for that column.

  • single_na: The number of single NA values (isolated missing values) for that column.

  • na: The total number of missing (NA) values for that column.

  • complete: The proportion of complete rows for that column, where a value of 1 means no missing data, and values closer to 0 mean more missing data.

Examples

## Not run: 
# Example usage with the 'flying' dataframe
summary_result <- drop_summary(flying)
print(summary_result)

## End(Not run)

Flying Etiquette Survey Data

Description

This is a modified version of the Flying Etiquette Survey data behind the story: 41 percent of flyers say it's rude to recline your seat on an airplane.

Usage

flying

Format

a dataframe 1040 obs. and 28 columns, which are:

respondent_id

respondentid

travel_frequency

how often do you travel by plane?

seat_recline

do you ever recline your seat when you fly?

height

how tall are you?

children_under_18

do you have any children under 18?

two_armrests

in a row of three seats, who should get to use the two arm rests?

middle_armrest

in a row of two seats, who should get to use the middle arm rest?

window_shade

who should have control over the window shade?

moving_to_unsold_seat

is it rude to move to an unsold seat on a plane?

talking_to_seatmate

generally speaking, is it rude to say more than a few words to the stranger sitting next to you on a plane?

getting_up_on_6_hour_flight

on a 6 hour flight from nyc to la, how many times is it acceptable to get up if you're not in an aisle seat?

obligation_to_reclined_seat

is it rude to recline your seat on a plane?

eliminate_reclining_seats

given the opportunity, would you eliminate the possibility of reclining seats on planes entirely?

switch_for_friends

is it rude to ask someone to switch seats with you in order to be closer to friends?

switch_for_family

is it rude to ask someone to switch seats with you in order to be closer to family?

wake_passenger_bathroom

is it rude to wake a passenger up if you are trying to go to the bathroom?

wake_passenger_walk

is it rude to wake a passenger up if you are trying to walk around?

baby_on_plane

in general, is it rude to bring a baby on a plane?

unruly_children

in general, is it rude to knowingly bring unruly children on a plane?

electronics_violation

have you ever used personal electronics during take off or landing in violation of a flight attendant's direction?

smoking_violation

have you ever smoked a cigarette in an airplane bathroom when it was against the rules?

gender

gender

age

age

household_income

household income

education

education

location_census_region

location (census region)

survey_type

type of the survey

Source

https://github.com/fivethirtyeight/data/tree/15f210532b2a642e85738ddefa7a2945d47e2585/flying-etiquette-survey

https://fivethirtyeight.com/features/airplane-etiquette-recline-seat/

Examples

data(flying)