Learn R Programming

BenfordTests (version 0.5)

leading_digits: Leading Digits

Description

Returns the specified number of significant digits for each element of a given vector.

Usage

leading_digits(x = NULL, number = 1)

Arguments

x
A numeric vector.
number
An integer determining the number of first digits to use for testing, i.e. 1 for only the first, 2 for the first two etc.

Value

  • Returns a vector of integers the same length as the input vector x.

Details

x is a numeric vector of arbitrary length. Unlike other solutions, this function will work reliably with all real numbers.

See Also

chi_square_benford; K_S_benford; Freedman_Watson_Usquare_benford; Chebyshev_dist_benford; Euclidean_dist_benford; J_S_avg_dev_benford; J_stat_squ_benford