suggest_var_names: Suggest variable names

Description Usage Arguments Value See Also Examples

View source: R/suggest_var_names.R

Description

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

Usage

1
2
3
4
5
6
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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" )
  )

retroharmonize documentation built on Nov. 3, 2021, 1:07 a.m.