removeZeros: Zeros replacement

View source: R/sampleCompute.R

removeZerosR Documentation

Zeros replacement

Description

Replace all zeros-like values (in [-threshold,+threshold]) by +threshold (if positive values are required) or +/-threshold.

Usage

removeZeros(x, threshold = .Machine$double.eps, positive = FALSE)

Arguments

x

numeric matrix or data.frame of raw data (points by line).

threshold

numeric value; must be positive.

positive

boolean: if TRUE, zeros-like values are replaced by +threshold

Details

removeZeros replaces all zeros-like values (in [-threshold,+threshold])

Value

x numeric matrix or data.frame of raw data (points by line), with no zeros.

Examples

dat <- rbind(matrix(rnorm(100, mean = 0, sd = 0.3), ncol = 2), 
             matrix(rnorm(100, mean = 2, sd = 0.3), ncol = 2), 
             matrix(rnorm(100, mean = 4, sd = 0.3), ncol = 2))
tf <- tempfile()
write.table(dat, tf, sep=",", dec=".")
x <- importSample(file.features=tf)

res <- removeZeros(x$features$initial$x)  



RclusTool documentation built on Aug. 29, 2022, 9:07 a.m.