Learn R Programming

healthyAddress (version 0.4.5)

postcode2ste: In what states do postcodes lie?

Description

While for most postcodes, the state enclosing it is easy to evaluate (e.g. most postcodes in 2000-2999 are in NSW), the general case is non-trivial. In particular, some postcodes straddle state borders.

Usage

postcode2ste(Postcodes, result = c("integer", "character"))

Value

A vector, the minimal states that cover all postcodes given. For example, if all postcodes lie within a single state a scalar integer/string of that state is returned.

Arguments

Postcodes

An integer vector of postcodes.

result

One of "integer" or "character". If "character" the abbreviated state names(s) are returned.

Examples

Run this code
vic_poa <- c(3021L, 3084L, 3013L, 3147L, 3030L,
             3123L, 3070L, 3004L, 3250L, 3630L)

postcode2ste(vic_poa)
postcode2ste(vic_poa, result = "character")
postcode2ste(c(vic_poa, 2000L))
postcode2ste(3644L)

Run the code above in your browser using DataLab