binarize_col: Convert single variable columns to multiple binary columns

Description Usage Arguments Value

Description

Convert single variable columns to multiple binary columns

Usage

1
binarize_col(data, col = 1:ncol(data), sep = ".", na.value = 0)

Arguments

data

Data frame.

col

Character or numeric. The names or indices of the columns of data to be converted.

sep

Character. The string to connect each variable to its value to create names for the binary columns.

na.value

Numeric. Value to assign to NA entries in value-specific columns. (NA entries are converted to 1 in NA columns.) Defaults to 0.

Value

A data frame having the same number of rows as data.


corybrunson/context documentation built on May 13, 2019, 10:52 p.m.