factorConvert: Converts factors into numeric or character arrays

Description Usage Arguments Value Examples

View source: R/miscUtils.R

Description

Converts factors into numeric or character arrays

Usage

1
factorConvert(var, to = "character")

Arguments

var

an array of factors to be converted

to

a string indicating whether factor should be converted to a character (to = "c") or a numeric (to = "n")

Value

a vector containing a converted version of var

Examples

1
2
3
4
5
6
> factorConvert(var = as.factor(letters[1:5]), to = "c")
[1] "a" "b" "c" "d" "e"
> factorConvert(var = as.factor(1:5), to = "c")
[1] "1" "2" "3" "4" "5"
> factorConvert(var = as.factor(1:5), to = "n")
[1] 1 2 3 4 5

kikapp/kikapputils documentation built on May 24, 2021, 10:41 p.m.