recode_vallab: Recode value labels based on numeric code

View source: R/recode_vallab.R

recode_vallabR Documentation

Recode value labels based on numeric code

Description

Recode value labels based on numeric code

Usage

recode_vallab(x, code, new_label)

Arguments

x

haven_labelled vector to be passed through.

code

Numeric value that specifies code where value label is to be replaced.

new_label

Character string to be used as the new value label.

Examples

x <- haven::labelled(c(1,2,3,2,1),c("a" = 1, "b" = 2, "d" = 3))
recode_vallab(x, code = 2, new_label = "Surprise!")


martinctc/surveytools documentation built on Nov. 21, 2024, 10:48 p.m.