assign_coding {rcoder}R 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)

[Package rcoder version 0.3.0 Index]