1% Generated by roxygen2: do not edit by hand 2% Please edit documentation in R/vec-na.R 3\docType{data} 4\name{missing} 5\alias{missing} 6\alias{na_lgl} 7\alias{na_int} 8\alias{na_dbl} 9\alias{na_chr} 10\alias{na_cpl} 11\title{Missing values} 12\format{ 13An object of class \code{logical} of length 1. 14 15An object of class \code{integer} of length 1. 16 17An object of class \code{numeric} of length 1. 18 19An object of class \code{character} of length 1. 20 21An object of class \code{complex} of length 1. 22} 23\usage{ 24na_lgl 25 26na_int 27 28na_dbl 29 30na_chr 31 32na_cpl 33} 34\description{ 35\Sexpr[results=rd, stage=render]{rlang:::lifecycle("questioning")} 36 37Missing values are represented in R with the general symbol 38\code{NA}. They can be inserted in almost all data containers: all 39atomic vectors except raw vectors can contain missing values. To 40achieve this, R automatically converts the general \code{NA} symbol to a 41typed missing value appropriate for the target vector. The objects 42provided here are aliases for those typed \code{NA} objects. 43} 44\details{ 45Typed missing values are necessary because R needs sentinel values 46of the same type (i.e. the same machine representation of the data) 47as the containers into which they are inserted. The official typed 48missing values are \code{NA_integer_}, \code{NA_real_}, \code{NA_character_} and 49\code{NA_complex_}. The missing value for logical vectors is simply the 50default \code{NA}. The aliases provided in rlang are consistently named 51and thus simpler to remember. Also, \code{na_lgl} is provided as an 52alias to \code{NA} that makes intent clearer. 53 54Since \code{na_lgl} is the default \code{NA}, expressions such as \code{c(NA, NA)} 55yield logical vectors as no data is available to give a clue of the 56target type. In the same way, since lists and environments can 57contain any types, expressions like \code{list(NA)} store a logical 58\code{NA}. 59} 60\section{Life cycle}{ 61 62 63These shortcuts might be moved to the vctrs package at some 64point. This is why they are marked as questioning. 65} 66 67\examples{ 68typeof(NA) 69typeof(na_lgl) 70typeof(na_int) 71 72# Note that while the base R missing symbols cannot be overwritten, 73# that's not the case for rlang's aliases: 74na_dbl <- NA 75typeof(na_dbl) 76} 77\keyword{datasets} 78\keyword{internal} 79