show_valuelabel: Show label informations of categories of a variable

View source: R/show_valuelabel.R

show_valuelabelR Documentation

Show label informations of categories of a variable

Description

Show label informations of categories of a variable

Usage

show_valuelabel(data = data, var.name = var.name)

Arguments

data

a data frame object created with read.codebook()

var.name

single text object of a varialbe name (could be non-quoted)

Value

This function returns a data frame of categorical valus and their labels of a variable, which are retrieved from '//dataDscr//var//catgry' in a ddi meta data file. If the variable contains no 'catgry' information, this function returns NA.

Examples

ddi.file.url  <- system.file("extdata","samplesurvey2018_ddi.xml",package="DDIR")
data.file.url <- system.file("extdata","samplesurvey2018_data.csv",package="DDIR")

read_codebook(ddi.file.url, data.file.url) -> dataset

show_question(dataset,'Q2')
show_question(dataset$Q2)

require(tidyverse)
dataset %>% show_valuelabel(Q2)
dataset %>% show_valuelabel('Q2')


ystnkn/DDIR documentation built on Oct. 17, 2023, 7:37 p.m.