getMaxNDecimals {inTextSummaryTable} | R Documentation |
Get maximum number of decimals in a variable, based on pre-defined rule and/or data.
Description
The function getNDecimals
) extracts the number
of decimals in a specific variable.
Usage
getMaxNDecimals(x, ...)
Arguments
x |
Numeric vector. |
... |
Any parameters for the |
Value
Integer with maximum number of decimals in a character vector.
Author(s)
Laure Cougnaud
See Also
Other decimals:
formatPercentage()
,
getMaxNDecimalsData()
,
getNDecimals()
,
getNDecimalsData()
Examples
x <- c(0.99, 5.679, 50.45, 1450)
# extract max number of decimals based on data:
getMaxNDecimals(x, useRule = FALSE, useData = TRUE)
# extract max number of decimals based on pre-defined rule:
getMaxNDecimals(x, useRule = TRUE, useData = FALSE)
# extract max number of decimals based on both rules
# minimum of both is used (by default)
getMaxNDecimals(x, useRule = TRUE, useData = TRUE)
[Package inTextSummaryTable version 3.3.3 Index]