Frac.Rd
Frac()
returns the fractional part of a numeric value.
MaxDigits()
return the number of digits in x
. Ndec()
returns the number of decimals.Prec()
returns the precision of a number x
.
Frac(x, dpwr = NA)
MaxDigits(x)
Ndec(x)
Prec(x)
x <- rnorm(5)*100
x
#> [1] 11.43823 52.13540 114.07801 122.32322 35.87269
Frac(x)
#> [1] 0.43822627 0.13539799 0.07801397 0.32322400 0.87269030
# multiply by 10^4
Frac(x, dpwr=4)
#> [1] 4382 1354 780 3232 8727
MaxDigits(c(1.25, 1.8, 12.0, 1.00000))
#> [1] 2
x <- c("0.0000", "0", "159.283", "1.45e+10", "1.4599E+10" )
Ndec(x)
#> [1] 4 0 3 2 4
Prec(as.numeric(x))
#> [1] 0.001