parse_parts: parse coordinates into degrees, minutes and seconds

parse_partsR Documentation

parse coordinates into degrees, minutes and seconds

Description

parse coordinates into degrees, minutes and seconds

Usage

parse_parts_lon(str)

parse_parts_lat(str)

Arguments

str

(character) string including longitude or latitude

Value

data.frame with columns for:

  • deg (integer)

  • min (integer)

  • sec (numeric)

For negative values the sign is carried by the first non-zero part: -45.5 gives deg -45, min 30, but -0.5 gives deg 0, min -30. Minutes are always below 60 and seconds below 60, in absolute value.

NA given upon error, with a warning

Examples

parse_parts_lon("140.4183318")
## Not run: 
parse_parts_lon("174.6411133")
parse_parts_lon("-45.98739874")
parse_parts_lon("40.123W")

parse_parts_lat("45N54.2356")
parse_parts_lat("40.4183318")
parse_parts_lat("-74.6411133")
parse_parts_lat("-45.98739874")
parse_parts_lat("40.123N")
parse_parts_lat("N40°25’5.994")

# multiple
x <- c("40.123°", "40.123N74.123W", "191.89", 12, "N45 04.25764")
parse_parts_lat(x)
system.time(parse_parts_lat(rep(x, 10^2)))

## End(Not run)


parzer documentation built on Nov. 24, 2026, 5:07 p.m.