suggest_var_names {retroharmonize}R Documentation

Suggest variable names

Description

The function harmonizes the variable names of surveys (of class survey) that are imported from an external file as a wave.

Usage

suggest_var_names(
  metadata,
  permanent_names = NULL,
  survey_program = NULL,
  case = "snake"
)

Arguments

metadata

A metadata table created by metadata_create and binded together for all surveys in waves.

permanent_names

A character vector of names to keep.

survey_program

If permanent_names = NULL then suggest_permanent_names is called with this parameter, unless it is also NULL

case

Unless it is set to NULL it will standardize the suggested variable name with to_any_case. The default is "snake".

Value

A metadata tibble augmented with $var_name_suggested

See Also

Other harmonization functions: collect_val_labels(), harmonize_na_values(), harmonize_values(), harmonize_var_names(), label_normalize(), suggest_permanent_names()

Examples

examples_dir <- system.file("examples", package = "retroharmonize")
survey_list <- dir(examples_dir)[grepl("\\.rds", dir(examples_dir))]

example_surveys <- read_surveys(
  file.path(examples_dir, survey_list), 
  save_to_rds = FALSE)
metadata <- lapply ( X = example_surveys, FUN = metadata_create )
metadata <- do.call(rbind, metadata)

utils::head(
  suggest_var_names(metadata, survey_program = "eurobarometer" )
  )

[Package retroharmonize version 0.2.0 Index]