powered by
Given an array, matrix, or vector, trim will truncate all elements smaller than epsilon (in absolute value) to zero.
trim
epsilon
trim(X, epsilon = 10^-6)
An array, a matrix, or a vector.
A numeric.
David Gerard.
All elements in X that are smaller than epsilon (in absolute value) will be set to zero then returned.
X
X <- c(0, 1, 10^-7, -1, -10^-7) X trim(X)
Run the code above in your browser using DataLab