How to replace NaN value with zero in a huge data frame?

The Solution to How to replace NaN value with zero in a huge data frame? is


It would seem that is.nan doesn't actually have a method for data frames, unlike is.na. So, let's fix that!

is.nan.data.frame <- function(x)
do.call(cbind, lapply(x, is.nan))

data123[is.nan(data123)] <- 0

~ Answered on 2013-08-09 08:46:22


Most Viewed Questions: