sig_digs: Calculate the number of significant figures in a number...

View source: R/sig_digs.R

sig_digsR Documentation

Calculate the number of significant figures in a number (borrowed from ???)

Description

Calculate the number of significant figures in an integer or floating point number. NOTE: this function IS NOT vectorized. To run on a vector of numbers, use sapply(x, sigDigs). Assumes that consecutive trailing 0s of integers and leading 0s of decimals are not significant. E.g. sigDigs(10) == 1.

Usage

sig_digs(n)

Arguments

n

numeric, the number for which to determine significant figures.

Value

integer, the number of significant figures


mjdufort/miscHelpers documentation built on Feb. 4, 2024, 7:44 p.m.