Repository navigation
Fixes from the review of the format, order and scrub() changes - #65
Merged
Merged
Conversation
"45E30.5, 10" now gives lat 10 and lon 45.508, like "45W30.5, 10". Strings with an exponent, such as "1.5e2, 4", now give NA for the longitude instead of the latitude. The "try order = lon_lat" hint now needs a latitude above 90 or below -90, not any NA latitude.
…ings As parse_lat() and parse_llstr(format = ) already do.
… parse_lon() A minus sign that disagrees with the letter, a number with two decimal points, and a value that does not match format.
README.md is knit again from README.Rmd, as the pre-commit hook does. The coverage block is now current (with R/format.R and src/scrub.cpp).
AlbanSagouis
added a commit
that referenced
this pull request
Nov 23, 2026
…dling of latin1 junk bytes On this branch the format path does not call check_encoding(), so the test pinned what R does with the byte 0x81: an error on macOS, NA with a warning on Windows. #65 replaces it with parzer's own error, the same on every platform.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes from a review of the changes since 0.5.0 (0f34152..3c3058d). The fixes for what #64 brought (latin1 bytes, locale-dependent tests, the "bytes" check) were pushed to #64 itself. This PR has the rest. It is based on
perf/cpp-scrub, so it shows only its own 8 commits.format: each number is turned into text on its own. Before,parse_lat(c(4530, 45.5), format = c("DDMM", "DD.d"))gaveNA 45.5, because 4530 became "4530.0" to match the decimals of 45.5.formatis about 10 times faster: fields are read withregexpr()and its capture positions instead ofregexec()andregmatches(). For 100 000 values,parse_lat(format = "DDMMSSH")takes 94 ms instead of 991 ms. A relative speed test now covers the format path, with a limit of 12 set from macOS only. Please check it against CI.format.parse_llstr()reads every E as a direction letter, so "45E30.5, 10" gives lat 10, lon 45.508. In strings with an exponent, such as "1.5e2, 4", theNAnow goes to the longitude instead of the latitude. The hint to tryorder = "lon_lat"now appears only when the latitude is out of range.parse_llstr()givesNAwithout a warning for "" and blank strings, asparse_lat()and the format path already did.parse_lat()andparse_lon()list the new causes ofNA. NEWS has one speed bullet, measured against 0.5.0. README is knit again (coverage 99.77%) and showsformatandorder, as does the vignette.Related Issue
Follows #64.
Example
devtools::test()passes at every commit (1934 expectations at the tip). The encoding tests were also run with LC_CTYPE set to a latin1 locale.