assign_coding: Adds a coding as an attribute to a vector

View source: R/recoding.R

assign_codingR Documentation

Adds a coding as an attribute to a vector

Description

Stores a coding at the "rcoder.coding" attribute of a vector

Usage

assign_coding(vec, .coding, .bpr = TRUE)

Arguments

vec

A vector

.coding

A 'coding' object

.bpr

Also overwrite the "bpr.coding" attribute with the character representation of '.coding'. Used for interop with blueprintr variable decorations.

Value

The vector with its "rcoder.coding" attribute set to '.coding'

See Also

[recode_vec()]

Examples

cdng <- coding(code("Yes", 3), code("Maybe", 2), code("No", 1))
vec <- sample(1:3, 50, replace = TRUE)
assign_coding(vec, cdng)

rcoder documentation built on Oct. 6, 2023, 9:06 a.m.