Join us for
RADAR: AI Edition

FIACH (version 0.1.2)

zeroNa: Zero non finite values

Description

This function replaces NA, Inf, -Inf, and NaN values of a matrix, array or vector with zero.

Usage

zeroNa(input)

Arguments

input
A numeric vector, matrix, or array. If an array it must have less than 5 dimensions.

Value

Returns the same input but with zeros in place of the non-finite values.

Examples

Run this code
 test<-matrix(rnorm(100),10,10)

test[5,5]<-NA
test
zeroNa(test)

test[5,5]<-NaN
test
zeroNa(test)

test[5,5]<- -Inf
test
zeroNa(test)

test[5,5]<- +Inf
test
zeroNa(test)

Run the code above in your browser using DataLab