as.na {JWileymisc} | R Documentation |
Coerces vectors to missing
Description
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).
Usage
as.na(x)
Arguments
x |
A vector to convert to missing (NA) |
Value
a vector the same length as the input with missing values of the same class
Examples
str(as.na(1L:5L))
str(as.na(rnorm(5)))
str(as.na(c(TRUE, FALSE)))
str(as.na(as.Date("2017-01-01")))
[Package JWileymisc version 1.4.1 Index]