renum_miss: Renumber missing id

Description Usage Arguments Value Examples

Description

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.

Usage

 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, ...)

Arguments

id

a numeric or character vector for which the missing codes will be replaced with NA

...

other arguments passed to specific methods

Value

a numeric or character vector

Examples

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)

tstev/pedr documentation built on May 11, 2019, 4:06 p.m.