nsf: Number of significant figures and number below decimal point,...

View source: R/nsf.R

nsfR Documentation

Number of significant figures and number below decimal point, general

Description

Take care of the number of significant figures (NSF) and number below decimal point with the following criteria (NBD).

Usage

nsf(data, NSF, NBD)

Arguments

data

data

NSF

Number of significant figures

NBD

Number below decimal point

Details

This sets the number of significant figures as NSF and number below decimal point as NBD. It removes trailing '.' and '0.'

Author(s)

Shoji F. Nakayama

Examples

## Not run: 
x <- c(1534, 153.4, 15.34, 1.534, 0.1534, 0.01534, 0.001534, 0.190, 0.200, 0.005, NA)
nsf(x, 3, 2)
nsf(x, 2, 2)
nsf(x, 3, 3)
nsf(x, 1, 1)

y <- c(5432, 543.2, 54.32, 5.432, 0.5432, 0.05432, 0.005432, 1.00, 0.0000, 0.00001, 0.005)
z <- data.frame(X = x, Y = y)
apply(z, 2, nsf, NSF = 3, NBD = 2)

## End(Not run)


fabregithub/r4jecs documentation built on June 13, 2025, 4:50 p.m.