The goal of retroharmonize is to facilitate retrospective (ex-post) harmonization of data, particularly survey data, in a reproducible manner. The package provides tools for organizing the metadata, standardizing the coding of variables, variable names and value labels, including missing values, and for documenting all transformations, with the help of comprehensive s3 classes.

import functions

Read data stored in formats with rich metadata, such as SPSS (.sav) files, and make them usable in a programmatic context.
read_spss: read an SPSS file and record metadata for reproducibility
read_rds: read an rds file and record metadata for reproducibility
read_surveys: programmatically read a list of surveys
subset_save_surveys: programmatically read a list of surveys, and subset them (pre-harmonize the same variables.)
pull_survey: pull a single survey from a survey list.

harmonization functions

Create consistent coding and labelling.
harmonize_values: merge_waves: Create a list of surveys with harmonized names and variable labels.
harmonize_waves: Create a list of surveys with harmonized value labels.
label_normalize removes special characters, whitespace, and other typical typing errors and helps the uniformization of labels and variable names.
na_range_to_values: Make the na_range attributes, as imported from SPSS, consistent with the na_values attributes.

documentation functions

Make the workflow reproducible by recording the harmonization process.

type conversion functions

Consistently treat labels and SPSS-style user-defined missing values in the R language. survey helps constructing a valid survey data frame, and labelled_spss_survey helps creating a vector for a questionnaire item. as_numeric: convert to numeric values.
as_factor: convert to labels to factor levels.
as_character: convert to labels to characters.
as_labelled_spss_survey: convert labelled and labelled_spss vectors to labelled_spss_survey vectors.