na.unreplace: na.unreplace

Description Usage Arguments Details See Also Examples

View source: R/na.unreplace.R

Description

Change values to NAs, ie make explicit NAs back to NA

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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) class(x) that are to be set to NA.

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:

1
x[ x 

na.unreplace is a S3 method that can be used to defince additional methods for other objects.

See Also

Examples

1
2
3
4
5
6
7
8
 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)
 
 

na.tools documentation built on June 26, 2018, 5:02 p.m.