get_geocode {dialr} | R Documentation |
Phone number geographical information
Description
Returns a text description for each phone number, in the language provided in
locale
.
Usage
get_geocode(x, home = NULL, strict = FALSE, locale = getOption("dialr.locale"))
Arguments
x |
A phone vector. |
home |
ISO country code for home region. See Details. |
strict |
Should invalid phone numbers be removed? If |
locale |
The Java locale
used to retrieve localised results. The default is set in option
|
Details
The description might consist of the name of the country where the phone number is from, or the name of the geographical area the phone number is from if more detailed information is available.
If a phone number is from the region specified in home
, only a
lower-level description will be returned, if one exists. Otherwise, the phone
number's region will be returned, with optionally some more detailed
information.
For example, for a user from the region "US"
(United States), we would show
"Mountain View, CA"
for a particular number, omitting the United States
from the description. For a user from the United Kingdom (region "GB"
), for
the same number we may show "Mountain View, CA, United States"
or even just
"United States"
.
Value
A text description for each phone number for the given locale, or
""
if the number is invalid or could belong to multiple countries.
libphonenumber reference
get_geocode()
:
PhoneNumberOfflineGeocoder.getDescriptionForValidNumber()
.
Examples
x <- phone(c(0, 0123, "0412 345 678", "61412987654", "03 9123 4567", "+12015550123"), "AU")
get_geocode(x)
get_geocode(x, strict = TRUE)
# Specify a home country
get_geocode(x, home = "AU")
get_geocode(x, home = "US")
# Specify a language
get_geocode(x, home = "DE", locale = "de")