knitr::opts_chunk$set( comment = "R>", echo = TRUE, output = TRUE, collapse = TRUE, eval = TRUE, warning = FALSE )
parzer
parses messy geographic coordinates
Docs: https://docs.ropensci.org/parzer/
You may get data from a published study or a colleague where the coordinates are in some messy character format that you'd like to clean up to get all decimal degree numeric data.
parzer
usageFor example, parse latitude and longitude from messy character vectors.
library("parzer")
parse_lat(c("45N54.2356", "-45.98739874", "40.123°"))
parse_lon(c("45W54.2356", "-45.98739874", "40.123°"))
And you can even split and parse strings that contain latitude and longitude together.
parse_llstr(c("4 51'36\"S, 101 34'7\"W", "40.123°; 45W54.2356"))
See more in the Introduction to the parzer
package vignette.
install.packages("parzer")
remotes::install_github("ropensci/parzer")
cat(paste(" -", paste(sprintf("`%s`", sort(getNamespaceExports("parzer"))), collapse = "\n - ")))
sp::char2dms
: is most similar to parzer::parse_lat
and parzer::parse_lon
.
However, with sp::char2dms
you have to specify the termination character for
each of degree, minutes and seconds. parzer
does this for the user.biogeo::dms2dd
: very unlike functions in this package. You must pass separate
degrees, minutes, seconds and direction to dms2dd
. No exact analog is found in
parzer
, whose main focus is parsing messy geographic coordinates in strings to
a more machine readable version.parzer
in R doing citation(package = 'parzer')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.