binary_transform: binary transform

View source: R/utility_functions.R

binary_transformR Documentation

binary transform

Description

Converts any variable with two possible values to a {0,1} binary variable.

Usage

binary_transform(x)

Arguments

x

A variable with two possible values.

Value

A vector with values in {0,1}.

Examples

## Convert a variable that takes values 'A' and 'B' to 0 and 1
x <- sample( c('A','B'), size = 10, prob = c(0.5,0.5), replace = TRUE )
print(x);flush.console()
binary_transform( x )

TSDT documentation built on April 4, 2025, 1:01 a.m.

Related to binary_transform in TSDT...