Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

manip_factor_2_numeric

converts factor to numeric preserving numeric levels and order in character levels.


Description

before converting we check whether the levels contain a number, if they do the number will be preserved.

Usage

manip_factor_2_numeric(vec)

Arguments

vec

vector

Value

vector

See Also

Examples

fac_num = factor( c(1,3,8) )
fac_chr = factor( c('foo','bar') )
fac_chr_ordered = factor( c('a','b','c'), ordered = TRUE )

manip_factor_2_numeric( fac_num )
manip_factor_2_numeric( fac_chr )
manip_factor_2_numeric( fac_chr_ordered )
# does not work for decimal numbers
manip_factor_2_numeric(factor(c("A12", "B55", "10e4")))
manip_factor_2_numeric(factor(c("1.56", "4.56", "8.4")))

easyalluvial

Generate Alluvial Plots with a Single Line of Code

v0.3.0
CC0
Authors
Bjoern Koneswarakantha [aut, cre] (<https://orcid.org/0000-0003-4585-7799>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.