This works like is.double()
and as.double()
, but is vectorised and can also check (and transform) comma-decimal input such as "0,1"
.
is.double(0.1)
#> [1] TRUE
is.double("0.1")
#> [1] FALSE
is.double("0,1")
#> [1] FALSE
is.double2(0.1)
#> [1] TRUE
is.double2("0.1")
#> [1] TRUE
is.double2("0,1")
#> [1] TRUE
is.double(c(0.1, "0.1", "0,1"))
#> [1] FALSE
is.double2(c(0.1, "0.1", "0,1"))
#> [1] TRUE TRUE TRUE
as.double(c(0.1, "0.1", "0,1"))
#> Warning: NAs introduced by coercion
#> [1] 0.1 0.1 NA
as.double2(c(0.1, "0.1", "0,1"))
#> [1] 0.1 0.1 0.1