count_decimals: Count decimal places

View source: R/utils.R

count_decimalsR Documentation

Count decimal places

Description

Examine an number and return the number of decimals present.

Usage

count_decimals(x)

Arguments

x

a vector of numeric values.

Details

Uses conversions from a numeric to character to splice off and count how many decimals are provided. Supports vectorization.

Value

Length of each values decimal places.

Examples

testing <- c(0, 100, 100.1, 101.10101, 100.00)
count_decimals(testing)

al-obrien/farrago documentation built on April 14, 2023, 6:20 p.m.