zi_repair {zippeR}R Documentation

Repair ZIP Code or ZCTA Vector

Description

This function repairs two of the four conditions identified in the validation checks with zi_validate(). For the other two conditions, values are conveted NA. See Details below for the specific changes made.

Usage

zi_repair(x, style = "zcta5")

Arguments

x

A vector containing ZIP or ZCTA values to be repaired.

style

A character scalar - either "zcta5" or "zcta3".

Details

The zi_repair() function addresses four conditions:

Since two of the four steps will result in NA values, it is strongly recommended to attempt to manually fix these issues first.

Value

A repaired vector of ZIP or ZCTA values.

Examples

# sample five-digit ZIPs with character
zips <- c("63088", "63108", "zip")

# failed validation
zi_validate(zips)

# repair
zips <- zi_repair(zips)

# successful validation
zi_validate(zips)


[Package zippeR version 0.1.0 Index]