dialr-type: Phone number type

Description Usage Arguments Value libphonenumber reference See Also Examples

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

1
2
3
4
5

Arguments

x

A phone vector, or a character vector of ISO country codes.

strict

If TRUE, invalid phone numbers return NA.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  # 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]
  

dialr documentation built on May 24, 2021, 5:07 p.m.