Learn R Programming

rcoder (version 0.3.0)

assign_coding: 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)

Value

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

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.

See Also

[recode_vec()]

Examples

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

Run the code above in your browser using DataLab