View source: R/create_codebook.R
| create_codebook | R Documentation |
Expand survey metadata into a long-format codebook of value labels.
create_codebook(metadata = NULL, survey = NULL)
codebook_waves_create(waves)
codebook_surveys_create(survey_list)
metadata |
A metadata table created by |
survey |
A survey object of class |
waves |
Deprecated alias for 'survey_list'. |
survey_list |
A list of 'survey' or 'survey_df' objects. |
create_codebook() returns a tidy data frame describing labelled
survey variables and their associated value labels. Each row
corresponds to a value label, classified as valid or missing.
Unlabelled numeric and character variables are excluded.
If both metadata and survey are supplied, survey takes
precedence.
For multiple surveys, use codebook_surveys_create().
A data frame with one row per value label, including:
Survey identifiers (id, filename).
Original variable names and labels.
Original value codes and labels, represented as character vectors.
Label range ("valid" or "missing").
Summary counts of value labels.
Additional user-defined metadata columns are preserved.
metadata_create(), codebook_surveys_create()
Other metadata functions:
metadata_create(),
metadata_survey_create()
Other harmonization functions:
collect_val_labels(),
crosswalk_surveys(),
harmonize_na_values(),
harmonize_survey_values(),
harmonize_values(),
harmonize_var_names(),
is.crosswalk_table(),
label_normalize()
survey <- read_rds(
system.file("examples", "ZA7576.rds", package = "retroharmonize")
)
cb <- create_codebook(survey = survey)
head(cb)
examples_dir <- system.file("examples", package = "retroharmonize")
survey_files <- dir(
examples_dir,
pattern = "\\.rds$",
full.names = TRUE
)
example_surveys <- read_surveys(survey_paths = survey_files)
head(codebook_surveys_create(example_surveys))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.