nsf | R Documentation |
Take care of the number of significant figures (NSF) and number below decimal point with the following criteria (NBD).
nsf(data, NSF, NBD)
data |
data |
NSF |
Number of significant figures |
NBD |
Number below decimal point |
This sets the number of significant figures as NSF and number below decimal point as NBD. It removes trailing '.' and '0.'
Shoji F. Nakayama
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.