decimaldigit {spm2} | R Documentation |
Digit number after decimal point for a numeric variable
Description
This function is to derive the digit number after decimal point for a numeric variable (e.g., lat and long).
Usage
decimaldigit(x, dechar = ".", nint = NA, ndec = NA, pad.left = TRUE)
Arguments
x |
one or more decimal numbers. |
dechar |
The character used to separate the decimal part of a number. |
nint |
The number of characters to which the integer part of the numbers should be padded. |
ndec |
The number of characters to which the decimal part of the numbers should be padded. |
pad.left |
Whether the left (integer) side of the numbers should be padded as well as the right. |
Value
A list of integer number to show digit number after decimal point of x.
Note
This function is modified from decimal.align in 'prettyR' package.
Author(s)
Jin Li
References
Jim Lemon and Philippe Grosjean (2019). 'prettyR': Pretty Descriptive Stats. R package version 2.1.1. https://CRAN.R-project.org/package=prettyR.
Examples
x<-c(0.1, 2.2, 3.03, 44.444, 555.0005, 6666.66666)
decimaldigit(x)
[Package spm2 version 1.1.3 Index]