Skip to contents

This function repairs and standardizes responses data after being read by read_gsed_fixed() to ensure that the responses data is in a consistent format.

Usage

repair_responses(responses, quiet = FALSE)

Arguments

responses

A data frame containing responses data with required columns.

quiet

Logical, if TRUE, suppresses output messages.

Value

A data frame with repaired and standardized responses data.

Details

The function performs several operations:

  • Converts 1–2 digit country codes to 3-digit format (e.g., 11-GSED-0123011-GSED-0123).

  • Converts GSED-0123 to 528-GSED-0123.

  • Standardizes specific country codes (e.g., 011- to 050-, 017- to 586-, 020- to 834-).

  • Deduplicates responses based on a unique identifier consisting of subjid, agedays, vist_type, and item.

The function is to be run after read_gsed_fixed()

A unique response identifier consists of: subjid, agedays, vist_type, item