% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/na.r
\name{na.vector}
\alias{na.vector}
\title{Create a vector of NA's}
\usage{
na.vector(
  length = 1L,
  type = c("logical", "integer", "double", "character", "complex", "numeric", "list")
)
}
\arguments{
\item{length}{integer, length of the output vector.}

\item{type}{character string naming an atomic type that has an
equivalent \code{NA} value (i.e., not \link{raw}), or \code{"list"}.}
}
\value{
vector of given mode and length filled with \code{NA} values.
}
\description{
For a given type and length, create a vector of \code{NA}'s.
}
\details{
This function also offers a \code{"list"} type, which gives a list
of single (logical) \code{NA} values. To initialize an empty list (of \code{NULL}'s)
of a given length, use \link{empty.list} instead.
}
\examples{
na.vector(5L)
x <- na.vector(3L, "character")
class(x)

x <- complex(1:5, 6:10)
y <- na.vector(length(x), typeof(x))
class(y)
length(y)

na.vector(2L, "list")
}
\seealso{
\link{vector}, \link{whichNA}, \link{setNA}
}
