dialr-region | R Documentation |
In libphonenumber a phone number region is represented by a 2 digit ISO
country code. get_region(x)
returns the 2-digit ISO country code for each element of a phone
vector.
Use get_supported_regions()
to see a full list of supported regions.
Region can also be retrieved from an international calling code.
get_region_for_calling_code(x)
returns the main region for each provided
calling code. Since multiple regions can share a single calling code,
get_regions_for_calling_code(x)
returns a list of character vectors of
regions for each.
get_region(x)
get_supported_regions()
get_region_for_calling_code(x)
get_regions_for_calling_code(x)
x |
A phone vector, or a vector of calling codes. |
A character vector of country codes.
get_regions_for_calling_code()
returns a list of character vectors for
each provided calling code.
get_region()
: PhoneNumberUtil.getRegionCodeForNumber()
get_supported_regions()
: PhoneNumberUtil.getSupportedRegions()
get_region_for_calling_code()
:
PhoneNumberUtil.getRegionCodeForCountryCode()
get_regions_for_calling_code()
:
PhoneNumberUtil.getRegionCodesForCountryCode()
Other phone functions:
dialr-example
,
dialr-match
,
dialr-phone
,
dialr-type
,
dialr-valid
,
dialr
# Get regions for a phone vector
x <- phone(c(0, 0123, "0412 345 678", "61412987654", "03 9123 4567", "+12015550123"), "AU")
get_region(x)
# All supported region codes
get_supported_regions()
# Primary region for a calling code
get_region_for_calling_code(c(1, 61, 84))
# All regions for a calling code
get_regions_for_calling_code(c(1, 61, 84))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.