R/is.naDS.R

Defines functions is.naDS

Documented in is.naDS

#' is.na() for DataSHIELD server
#'
#' This function is a wrapper for \code{base::is.na()}.
#' @details If the length of input vector is less than the set filter
#' a missing value is returned.
#' @inheritParams base::is.na
#' @return A logical object conforming to \code{x}
#' @author Adapted from \url{https://github.com/gflcampos/dsMice/blob/master/R/notNaDS.R}
#' @seealso \code{\link[base]{is.na}}
#' @export
#' @examples
#' library(mice)
#' pat <- is.naDS(nhanes)
is.naDS <- function(x) {

  # check if the input vector is valid (i.e. meets DataSHIELD privacy criteria)
  check <- isValidDS(x)

  # return missing value if the input vector is not valid
  if (check) {
    result <- is.na(x)
  } else {
    result <- NA
  }

  return(result)
}
stefvanbuuren/dsMice documentation built on Aug. 26, 2020, 1:44 p.m.