R: Specify missing values for a vector

specify_missing {rccmisc} | R Documentation

## Specify missing values for a vector

### Description

Change specified values to NA

### Usage

    specify_missing(x, ..., default_missing = c("", NA, "blanks"))

### Arguments

`x` | vector
`...` | values that should be changed to `NA` if found in `x`
`default_missing` | a vector with additional default values to change to NA. These are treated the same as `...` but are added by default if not removed. A special value `"blank"` can be used to indicate all empty strings (all characters matching `[:blank:]`, see regex).

### Value

x itself but with specified values set to `NA`.

### Examples

    x <- sample(100)
    x[sample(100, 10)] <- 999
    specify_missing(x, 999)

[Package rccmisc version 0.3.7 Index]