R/is.nan.data.frame.R

Defines functions is.nan.data.frame

Documented in is.nan.data.frame

#' @title
#' NaN
#'
#' @description
#' function to extend data.frame class, adding NaN checking.
#'
#' @param data a data.frame
#'
#' @examples
#'
#' d <- data.frame(c1 = rep(NaN, 10), c2 = rep(NaN, 10))
#' d[is.nan(d)] <- 0
#'
#' @export is.nan.data.frame
#' @method is.nan data.frame

is.nan.data.frame <- function(d) {

  if (is.data.frame(d) == FALSE) {
    stop("d must be a data.frame.")
  }
  do.call(cbind, lapply(d, is.nan))
}
rladeira/rutils documentation built on May 27, 2019, 9:28 a.m.