na.unreplace {na.tools} | R Documentation |
na.unreplace
Description
Change values to NAs, ie make explicit NAs
back to NA
Usage
na.unreplace(x, values)
## Default S3 method:
na.unreplace(x, values = NULL)
## S3 method for class 'character'
na.unreplace(x, values = c("NA", NA_explicit_))
## S3 method for class 'factor'
na.unreplace(x, values = c("NA", NA_explicit_))
na.implicit(x, values)
Arguments
x |
object |
values |
values that are (or can be coerced to) |
Details
na.unreplace
replaces values
by NA
. It is meant to be nearly inverse
operation to na_replace
(and na_explicit
). It can be used on both atomic
and recursive objects. Unlike na.replace
however, values
express the
values that if matched are set to NA
. It is basically:
x[ x
na.unreplace
is a S3 method that can be used to defince additional
methods for other objects.
See Also
Examples
na.unreplace( c(1,2,3,4), 3 )
na.unreplace( c("A", "(NA)", "B", "C") )
na.unreplace( c("A", NA_explicit_, "B", "C") )
df <- data.frame( char=c('A', 'NA', 'C', NA_explicit_), num=1:4 )
na.unreplace(df)
[Package na.tools version 0.3.1 Index]