as.na | R Documentation |
Given a vector, convert it to missing (NA) values, where the class of the missing matches the input class. Currently supports character, logical, integer, factor, numeric, times (from chron), Date, POSIXct, POSIXlt, and zoo (from zoo), and haven labelled from haven.
as.na(x)
x |
A vector to convert to missing (NA) |
a vector the same length as the input with missing values of the same class
str(as.na(1L:5L))
str(as.na(rnorm(5)))
str(as.na(c(TRUE, FALSE)))
str(as.na(as.Date("2017-01-01")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.