% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/replace_helpers.R
\name{preserve_na}
\alias{preserve_na}
\alias{restore_na}
\title{Preserve and restore NA information within a vector}
\usage{
preserve_na(x)

restore_na(y, na_info)
}
\arguments{
\item{x}{A vector containing missing \code{NA} values.}

\item{y}{A vector of valid non-\code{NA} values returned from \code{preserve_na()}.}

\item{na_info}{A list returned from \code{preserve_na()}.}
}
\value{
\code{preserve_na()} returns a list \code{na_info} with components:
\itemize{
\item \code{na_info$x_valid}: A vector with \code{NA} values removed.
\item \code{na_info$x_length}: A numeric value of the original input vector length.
\item \code{na_info$na_idx}: A logical vector preserving \code{NA} positions.
}

\code{restore_na()} returns a vector \code{y} the same length as the original
input vector \code{x} with \code{NA} values restored to their original positions.
}
\description{
\code{preserve_na()} stores \code{NA} vector positions and extracts valid non-\code{NA}
values for later restoration with \code{restore_na()}.

\code{restore_na()} restores \code{NA} values to their original vector positions
after processing valid non-\code{NA} values returned from \code{preserve_na()}.
}
\keyword{internal}
