R/zerona.R

Defines functions zerona

Documented in zerona

#' Turn zeros to missing values
#' @param x A vector, matrix, or data frame.
#' @return An object of the same class with zeros replaced by \code{NA}.
#' @export
zerona <- function(x) {
  x[x == 0] <- NA
  x
}

Try the dataprep package in your browser

Any scripts or data that you put into this service are public.

dataprep documentation built on Oct. 1, 2026, 5:07 p.m.