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)))

}
ramiromagno/quincunx documentation built on June 2, 2025, 1:23 a.m.