Zapsmall | R Documentation |
Put to zero values "close" to zero.
## Default S3 method:
Zapsmall(x, digits = getOption("digits"), ...)
## S3 method for class 'data.frame'
Zapsmall(x, digits = getOption("digits"), except = NULL, ...)
x |
A |
digits |
Integer indicating the precision to be used. |
except |
Indices of columns not to be zapped (if any). |
... |
Arguments for future expansion. |
This function "extends" to data.frame
objects function zapsmall
from the package base.
The method for class data.frame 'zaps' values close to zero occurring in columns of x
. Argument except
can be used to prevent specific columns from being zapped.
The default method is a bare copy of the original function from package base.
An object of the same class of x
, with values "close" to zero zapped to zero.
Diego Zardetto
The original function zapsmall
from package base.
# Create a test data frame with columns containing
# values of different orders of magnitude:
data <- data.frame(a = pi*10^(-8:1), b = c(rep(1000,8), c(1E-5, 1E-6)))
# Print on screen the test data frame:
data
# Compare with its zapped version:
Zapsmall(data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.