Learn R Programming

nettskjemar (version 1.0.1)

ns_add_labels: Add Labels to Dataset

Description

The `ns_add_labels` function applies labels to variables in a dataset based on a provided codebook. It assigns variable labels, value labels, and metadata required for the "ns-data" class.

Usage

ns_add_labels(data, codebook)

Value

A data frame with the same structure as `data`, but with variable and value labels applied. The resulting object is assigned the class `"ns-data"`.

Arguments

data

data from ns_get_data

codebook

object from ns_get_codebook

Examples

Run this code
if (FALSE) {
data <- ns_get_data(11000)
cb <- ns_get_codebook(11000)
labeled_data <- ns_add_labels(data, cb)
}

Run the code above in your browser using DataLab