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 usage
For example, parse latitude and longitude from messy character vectors.
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"))
R> lat lon
R> 1 -4.86 -101.6
R> 2 40.12 -45.9Some values pack degrees, minutes and seconds together with no separator, as in “4530N”. Without help, parzer reads them as NA. Give a format that says how they are written. With several formats, each value is read with the first one that matches.
When the longitude comes first and there is no direction letter, parzer cannot tell. Say so with order.
See the Format section of ?parse_lat and the Order section of ?parse_llstr for details.
See more in the Introduction to the parzer package vignette.
Installation
Stable version:
install.packages("parzer")Development version:
pak::pkg_install("ropensci/parzer")List of functions:
parse_hemisphereparse_latparse_llstrparse_lonparse_lon_latparse_parts_latparse_parts_lonpz_dpz_degreepz_mpz_minutepz_spz_second
Similar art
-
sp::char2dms: is most similar toparzer::parse_latandparzer::parse_lon. However, withsp::char2dmsyou have to specify the termination character for each of degree, minutes and seconds.parzerdoes this for the user. -
biogeo::dms2dd: very unlike functions in this package. You must pass separate degrees, minutes, seconds and direction todms2dd. No exact analog is found inparzer, whose main focus is parsing messy geographic coordinates in strings to a more machine readable version.
Code Coverage
R> parzer Coverage: 99.77%
R> src/latlong.cpp: 98.90%
R> R/dms-fxns.R: 100.00%
R> R/format.R: 100.00%
R> R/parse_hemisphere.R: 100.00%
R> R/parse_lat.R: 100.00%
R> R/parse_llstr.R: 100.00%
R> R/parse_lon_lat.R: 100.00%
R> R/parse_lon.R: 100.00%
R> R/parse_parts.R: 100.00%
R> R/zzz.R: 100.00%
R> src/parse.cpp: 100.00%
R> src/pz_hemisphere.cpp: 100.00%
R> src/pz_parse_parts.cpp: 100.00%
R> src/pz_split_llstr.cpp: 100.00%
R> src/scrub.cpp: 100.00%Meta
- Please report any issues or bugs.
- License: MIT
- Get citation information for
parzerin R doingcitation(package = 'parzer') - Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
