as_numeric.Rdas_numeric is essentially a wrapper to as.numeric except that objects of class factor are first coerced to character and then to numeric.
is_numeric test if x is "somehow numeric" (see examples).
as_numeric(x) is_numeric(x)
| x | object to be coerced or tested
(and return a logical vector of the same length) or should it test the whole
vector as one object and return a logical vector of length one. ( |
|---|
#> [1] "factor"#> [1] 2 1# but as_numeric(df$v) # 46513 45#> [1] 46513 45is_numeric(1) # TRUE#> [1] TRUEis_numeric("1") # TRUE#> [1] TRUE#> [1] TRUE#> [1] FALSE