% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/valid_na_index.R
\name{valid_na_index}
\alias{valid_na_index}
\title{Validate the declared missing values index}
\usage{
valid_na_index(x)
}
\arguments{
\item{x}{An atomic vector, possibly containing an \code{na_index} attribute.}
}
\value{
A logical value. \code{TRUE} when every indexed value is a genuine \code{NA};
otherwise \code{FALSE}.
}
\description{
Check whether every position stored in the \code{na_index} attribute identifies a
genuine missing value in the vector. This can detect when external code has
changed a vector without refreshing its declared missing values metadata.
}
\details{
The check examines only the positions in \code{na_index} and stops at the first
invalid position. A missing or empty \code{na_index} attribute is valid.
}
\examples{
x <- declared(c(1, -1, 3), na_values = -1)

valid_na_index(x)

attr(x, "na_index") <- 1
valid_na_index(x)
}
