as_numeric: convert to numeric passing through character for safety

Description Usage Arguments Examples

View source: R/as_numeric.R

Description

convert to numeric passing through character for safety

Usage

1

Arguments

x

vector

...

additional argument to as.character

Examples

1
2
3
4
5
6
7
8
9
# factor with weird levels that we don't want to keep
ex <- factor(c(1, 2, 3, 4), levels = c(2, 3, 1, 4)) 
ex

# keeps information about the levels, oh no!
as.numeric(ex) 

# keeps the labelled values
as_numeric(ex)

PKPDmisc documentation built on April 14, 2020, 5:49 p.m.