getMaxNDecimals: Get maximum number of decimals in a variable, based on...

View source: R/decimals.R

getMaxNDecimalsR 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 getNDecimals function.

Value

Integer with maximum number of decimals in a character vector.

Author(s)

Laure Cougnaud

See Also

Other decimals: formatPercentage(), getMaxNDecimalsData(), getNDecimalsData(), getNDecimals()

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)

inTextSummaryTable documentation built on Sept. 12, 2023, 5:06 p.m.