← Back to all sparks
D

dialr

INFRA · APIS
Velocity0.0

Parse, Format, and Validate International Phone Numbers

The R phone-number package stopped only parsing numbers and started asking them where they are.

phone-numberslibphonenumberrjavar-packagevalidationgeocoding
Current state
dialr wraps Google's libphonenumber through rJava, giving R a phone vector class that parses, validates and formats international numbers. It has been quiet since August 2022, when the last release removed a pathology where Java would freeze after enough invalid inputs. The package covers parsing, validation, formatting, and the metadata lookups added in 0.3.0.
Where it's heading
Two forces shape the history. One is expansion into what libphonenumber knows beyond the number itself — carrier, geocode, timezone — which happened once, in 2019, and has not been extended since. The other is the ongoing cost of being a Java wrapper inside an R tidyverse: rJava initialisation moved so the :: form works, phone vectors reclassified when tibble 3.0.0 changed how it treats list-based classes, and repeated performance work to make crossing the Java boundary tolerable. The maintainer has floated moving the phone class onto vctrs but has not.
Prediction
The vctrs migration is the one change the maintainer has explicitly signalled, and the hard-deprecated one-shot functions were slated for removal in the next major release; three years of silence make neither imminent.

Recent moves

  1. 3y ago

    Invalid values short-circuit the Java parser, fixing a freeze

    Values that are not numbers at all — empty strings, NA — are now filtered before they reach the Java parser, which both speeds up bulk parsing sharply and fixes a freeze that hit after a large volume of invalid inputs. Progress bar visibility moves from a package-wide option to a per-call argument.

    View source ↗
  2. 5y ago

    Java initialises on load, so :: calls work without library()

    rJava initialisation moves to .onLoad(), so dialr::phone() finally works without a preceding library(dialr) — a real annoyance for a Java-backed package used inside other packages. The old one-shot processing functions become hard errors, with removal promised for the next major version.

    View source ↗
  3. 6y ago

    R 4.0 bump and tests decoupled from libphonenumber data

    An R 4.0.0 version bump plus tests rewritten to stop depending on specific libphonenumber data values, so upstream metadata updates no longer break the suite. Maintenance only.

    View source ↗
  4. 6y ago

    Phone vectors work in tibbles again after the 3.0.0 change

    Repairs phone vectors inside tibbles, broken by tibble 3.0.0's changed handling of list-based classes, by giving them the list class as the tibble changelog recommends. The maintainer notes vctrs as the eventual home for the class once it stabilises — a plan still unexecuted three years later.

    View source ↗
  5. 7y ago

    Carrier, geocode, and timezone lookups added

    ⚡ SPARK

    The release that widened the package's job. Until now dialr answered questions about a number's form — is it valid, what region, what type; from here it answers questions about the world behind the number. Nothing since has extended this surface, which makes it the high-water mark of the package's scope.

    View source ↗
  6. 7y ago

    Tenfold rJava speedup and proper phone equality

    Roughly tenfold speedups from more efficient rJava access and caching of static values — the recurring tax of calling Java from R. is_match() gives phone vectors a correct equality test and is wired into == and !=, and get_example() generates sample numbers per region and type.

    View source ↗