set_varl: Set variable labels

View source: R/set_varl.R

set_varlR Documentation

Set variable labels

Description

A pipe-workflow optimised method to set variable labels.

Usage

set_varl(x, variable_label)

Arguments

x

Variable to assign variable labels to

variable_label

String vector to be assigned as the variable label

See Also

Other Labels: set_vall()

Examples

library(tibble)
library(dplyr)
library(magrittr)
df <-
tibble(RESPID=1:1000,
       Q1=sample(c(0,1,2),1000,replace=TRUE),
       Q2=sample(c(0,1),1000,replace=TRUE))
df %>%
  mutate_at("Q1",funs(set_varl(.,"Which of the following groups do you fall into?"))) %>%
  .$Q1

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