extract.digits {benford.analysis} | R Documentation |

It extracts the leading digits from the data.

This function is used by the main function of the package `benford`

to extract the
leading digits of the data.

```
extract.digits(data, number.of.digits = 2,
sign="positive", second.order = FALSE, discrete=TRUE, round=3)
```

`data` |
a numeric vector. |

`number.of.digits` |
how many first digits to analyse . |

`sign` |
The default value for sign is "positive" and it analyzes only data greater than zero. There are also the options "negative" and "both" that will analyze only negative values or both positive and negative values of the data, respectively. For large datasets with both positive and negative numbers, it is usually recommended to perform a separate analysis for each group, for the incentives to manipulate the numbers are usually different. |

`second.order` |
If TRUE, the function will extract the first digits of the second order distribution. |

`discrete` |
Most real data - like population numbers or accounting data - are discrete, so the default is TRUE. This paramater sets rounding to the differences of the ordered data to avoid floating point number errors in the second order distribution, that usually occurs when data is discrete and the ordered numbers are very close to each other. If your data is continuous (like a simulated lognormal) you should run with discrete = FALSE. |

`round` |
it defines the number of digits that the rounding will use if discrete = TRUE and second.order = TRUE. |

A data.frame with the data and the first digits.

[Package *benford.analysis* version 0.1.5 Index]