Fractional Part and Maximal Digits of a Numeric Value
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 |
the numeric value (or a vector of numerics), whose fractional part is to be calculated. |
dpwr |
power of 10 for a factor z, the fractional part will be multiplied with. The result will be returned rounded to integer. Defaults to |
Andri Signorell <andri@signorell.net>
x <- rnorm(5)*100 x Frac(x) # multiply by 10^4 Frac(x, dpwr=4) MaxDigits(c(1.25, 1.8, 12.0, 1.00000)) x <- c("0.0000", "0", "159.283", "1.45e+10", "1.4599E+10" ) Ndec(x) Prec(as.numeric(x))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.