Description Usage Arguments Details Value References See Also Examples
extractdigits
extracts the first nonzero numdigits
significant digits of the user's data, x
.
1 | extractdigits(x, numdigits = 1)
|
x |
Numeric matrix or vector. |
numdigits |
A positive integer, default is 1. |
"0" entries are omitted from the data.
The first n significant digits of a non-zero number are the first n non-zero digit of the number. For example, the first two significant digits of "012" are "12".
The first n significant digits of a number that has less than m < n digits is given by the m-digit number concatenated with (m-n) zeroes. For example, the first four significant digits of "1.2" are "1200".
The output is a vector of first numdigits
for nonzero entries
in x
(taken in column-major order if x
is a matrix).
Lesperance M, Reed WJ, Stephens MA, Tsao C, Wilton B (2016) Assessing conformance with Benford's Law: goodness-of-fit tests and simultaneous confidence intervals. PLoS one; 11(3).
1 2 | extractdigits(1:10, 1)
extractdigits(c(012, 1.2, 1, 0),2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.