charvecs_to_named_charvec_tc: Combined two character vectors into code declaring a named...

View source: R/charvecs_to_named_charvec_tc.R

charvecs_to_named_charvec_tcR Documentation

Combined two character vectors into code declaring a named character vector on the clipboard

Description

Takes two character vectors as inputs, writes code declaring a named character vector onto the clipboard. Useful for creating 1:1 maps when recoding variable names.

Usage

charvecs_to_named_charvec_tc(names, values)

Arguments

names

character vector with the names for the named character vector written to clipboard

values

character vector with the values for the named character vector written to clipboard

Examples


old.varnames <- c("v1", "v2", "v3")
new.varnames <- c("age", "height", "weight")

charvecs_to_named_charvec_tc(new.varnames, old.varnames)

# Now paste to see that this text is on your clipboard:
# c('age' = 'v1',
#   'height' = 'v2',
#   'weight' = 'v3')

wepelham3/sack2 documentation built on Aug. 5, 2023, 5:53 a.m.