R/na_indices.R

Defines functions na_indices

#' Return indices of NA values
#'
#' Returns the indices of values that are `NA` in a vector.
#' Useful for comparing vectors.
#'
#' @param vector Vector with NA values to be indexed.
#'
#' @return A vector of indices of `NA` values.
#' @import magrittr
#' @noRd
#'
#' @examples
#' na_indices(vector)
na_indices <- function(vector) {
  vector %>%
    is.na() %>%
    which()
}
JonasEngstrom/prexRiswr documentation built on Dec. 18, 2021, 1:41 a.m.