trim {tensr}R Documentation

Truncates small numbers to 0.

Description

Given an array, matrix, or vector, trim will truncate all elements smaller than epsilon (in absolute value) to zero.

Usage

trim(X, epsilon = 10^-6)

Arguments

X

An array, a matrix, or a vector.

epsilon

A numeric.

Details

All elements in X that are smaller than epsilon (in absolute value) will be set to zero then returned.

Author(s)

David Gerard.

Examples

X <- c(0, 1, 10^-7, -1, -10^-7)
X
trim(X)

[Package tensr version 1.0.1 Index]