Description Usage Arguments Value Examples
renum_miss()
will replace certain values with NA. For numeric vectors ids
coded as 0
or -99
will be considered as missing or unknown. For character
vectors this is extended to include '.'
, '*'
, 'NA'
and whitespaces.
1 2 3 4 5 6 7 8 9 10 | renum_miss(id, ...)
## Default S3 method:
renum_miss(id, ...)
## S3 method for class 'character'
renum_miss(id, ...)
## S3 method for class 'numeric'
renum_miss(id, ...)
|
id |
a numeric or character vector for which the missing codes will be replaced with NA |
... |
other arguments passed to specific methods |
a numeric or character vector
1 2 3 4 5 6 7 | set.seed(42L)
ids <- rpois(50, 100)
ids[sample.int(50, 10)] <- c(0L, -99)[sample.int(2, 10, replace = TRUE)]
renum_miss(ids)
ids <- c("A", "B", ".", "D", "*", "NA", " ", "H")
renum_miss(ids)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.