dialr-type {dialr} | R Documentation |
Phone number type
Description
In addition to validity, libphonenumber can identify phone number type - it is able to distinguish Fixed-line, Mobile, Toll-free, Premium Rate, Shared Cost, VoIP, Personal Numbers, UAN, Pager, and Voicemail (whenever feasible).
get_type(x)
returns the phone number type for each element of a phone
vector.
Valid phone number types differ by region. get_types_for_region(x)
returns
a list of character vectors of valid types for each provided
ISO country code. Use get_supported_types()
to see a full
list of supported types.
Usage
get_type(x, strict = FALSE)
get_supported_types()
get_types_for_region(x)
Arguments
x |
A phone vector, or a character vector of ISO country codes. |
strict |
If |
Value
A character vector of phone types.
get_types_for_region()
returns a list of character vectors for each
provided country code.
libphonenumber reference
get_type()
: PhoneNumberUtil.getNumberType()
get_supported_types()
: PhoneNumberUtil.PhoneNumberType
get_types_for_region()
: PhoneNumberUtil.getSupportedTypesForRegion()
See Also
Other phone functions:
dialr-example
,
dialr-match
,
dialr-phone
,
dialr-region
,
dialr-valid
,
dialr
Examples
# Get phone types for a phone vector
x <- phone(c(0, 0123, "0412 345 678", "61412987654", "03 9123 4567", "+12015550123"), "AU")
get_type(x)
# All supported phone types
get_supported_types()
# Get supported types for specified regions
get_types_for_region("AU")
get_types_for_region(c("GB", "US"))
get_types_for_region(get_supported_regions())[1:5]