as_numeric: as_numeric

Description Usage Arguments Examples

Description

String und Factor zu Numeric.

Usage

1
as_numeric(x, na.strings = NULL, type = class(x))

Arguments

x

vector

na.strings

Fehlende Werte

type

factor, numeric, time

Examples

1
2
3
4
5
6
7
8
x <- c("0","-3","+5"," 5.6","   3,5  ","3,,4","3-5","uk","na",-77,-99,-999)
f<- factor(c(4,  16, 8,  1,  4,  1,  2,  4,  2,  2,  -77,  4 ))

data.frame(x=x,
           x_as_num=as_numeric(x, na.strings = c("-77", "-99")),
           
           f=f,
           f_as_num=as_numeric(f, na.strings = c("-77", "-99"))) 

stp4/stp25aggregate documentation built on Sept. 17, 2021, 5:34 a.m.