attach_varlab: Append variable labels for Stata export

View source: R/stata-helpers.R

attach_varlabR Documentation

Append variable labels for Stata export

Description

Append variable labels for Stata export

Usage

attach_varlab(tbl, labels, overwrite = TRUE)

Arguments

tbl

A dataset

labels

A set of levels. Either a tibble that has two columns called 'alias' and 'description', OR a vector of the form 'c(alias1 = "description1", alias2 = "description2)' that can be coerced into one.

Examples

 mt_stata <- as_tibble(mtcars) |>
  attach_varlab(c(cyl = "Number of cylinders", hp = "Gross horsepower"))

 # bulk edits by a tibble format
 vartab <- tribble(
  ~ alias, ~description,
  "cyl",  "Number of cylinders",
  "hp",  "Gross horsepower"
 )
 mt_stata <- as_tibble(mtcars) |>
  attach_varlab(vartab)



kuriwaki/rcces documentation built on Sept. 12, 2023, 5:31 p.m.