Coerce all columns in the object to factor
(i.e. stringsAsFactors
).
Usage
factorize(object, ...)
# S4 method for DFrame
factorize(object, j = NULL)
# S4 method for atomic
factorize(object)
# S4 method for data.frame
factorize(object, j = NULL)
# S4 method for factor
factorize(object)
Examples
## DFrame ====
object <- S4Vectors::DataFrame(
"a" = c("a", "b", "c", "d"),
"b" = c("a", "a", "b", "b"),
"c" = c(1L, 2L, 3L, 4L),
"d" = c(1L, 2L, 1L, 2L),
"e" = c(TRUE, TRUE, FALSE, FALSE),
row.names = c("A", "B", "C", "D")
)
object <- factorize(object)
print(object)
#> DataFrame with 4 rows and 5 columns
#> a b c d e
#> <character> <factor> <integer> <factor> <logical>
#> A a a 1 1 TRUE
#> B b a 2 2 TRUE
#> C c b 3 1 FALSE
#> D d b 4 2 FALSE