Skip to contents

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

Usage

repair_visits(visits, quiet = FALSE)

Arguments

visits

A data frame containing visit data with required columns.

quiet

Logical, if TRUE, suppresses output messages.

Value

A data frame with repaired and standardized visit data.

Details

The function performs several operations:

  • Ensuring required columns are present

  • Repairing subjid according to ISO 3166-1 numeric code

  • Defining GSED cohort and cohort number

  • Removing duplicate visits based on unique identifiers

  • Sorting the data by cohort, subjid, agedays, vist_type, and ins

The function is to be run after read_gsed_fixed()

A unique visit identifier consists of: subjid, agedays, vist_type, ins