R/first_non_na.R

Defines functions first_non_na

Documented in first_non_na

#' Returns the position of the first non-NA value
#'
#' @param x An atomic vector.
#' @keywords internal
first_non_na <- function(x) {

  if(all(is.na(x))) return(NA_integer_)
  else min(which(!is.na(x)))

}

Try the quincunx package in your browser

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

quincunx documentation built on July 9, 2023, 7:32 p.m.