binary2factor {epocakir}R Documentation

Convert binary data to factors based on column name

Description

Convert binary data to factors based on column name

Usage

binary2factor(.data, ...)

Arguments

.data

(data.frame) A data frame or data frame extension (e.g. a tibble)

...

Name-value pairs. The names of columns to be transformed

Value

(data.frame) An object of the same type as .data

Examples

df <- data.frame(
  a = c(1, 0, NA, 1, 0),
  b = c("y", "n", NA, "Y", "n"),
  c = c("yes", "no", NA, "Yes", "No"),
  d = c(TRUE, FALSE, NA, TRUE, FALSE),
  e = c(1, 2, 3, 4, 5)
)
binary2factor(df, a, b:d)
df %>%
  binary2factor(-e)

[Package epocakir version 0.9.9 Index]