Skip to contents

BEWARE: EXPERIMENTAL

Usage

parse_hemisphere(lon, lat)

Arguments

lon

(character/numeric/integer) one or more longitude values

lat

(character/numeric/integer) one or more latitude values

Value

character vector of quadrants, one of: NE, NW, SE, SW. if one of the coordinate values is invalid, and one is valid, you get a length 1 string. if both coordinate values are bad, you get a zero length string.

Warnings are thrown on invalid values

Details

length(lon) == length(lat)

Examples

# NE
parse_hemisphere("74.123E", "45N54.2356")
#> [1] "NE"
if (FALSE) {
# NW
parse_hemisphere(-120, 40.4183318)
# SW
parse_hemisphere(-120, -40.4183318)
# SE
parse_hemisphere(120, -40.4183318)

# bad inputs, get one of the two strings
parse_hemisphere(-181, -40.4183318)
parse_hemisphere(-120, -192.4183318)

# many inputs
n <- 100
lons <- runif(n, min = -180, max = 180)
lats <- runif(n, min = -90, max = 90)
parse_hemisphere(lons, lats)
}