In a matrix or within matrices in a list,
replace all NaN
matrix values with val.
Arguments
- a
A matrix of list of matrices in which
NaN
will be replaced byval
.- val
NaN
s are replace byval.
Examples
suppressWarnings(a <- matrix(c(1, sqrt(-1))))
replaceNaN_byname(a)
#> [,1]
#> [1,] 1
#> [2,] 0
replaceNaN_byname(a, 42)
#> [,1]
#> [1,] 1
#> [2,] 42