dialr-example: Get an example phone number

Description Usage Arguments Value libphonenumber reference See Also Examples

Description

Produces example phone numbers for the given region, type and valid combinations. Input vectors are recycled as necessary if a vector of length 1 is provided.

Usage

1
get_example(region, type = NULL, valid = TRUE)

Arguments

region

A character vector of ISO country codes.

type

A character vector of phone number types for each region. If NULL (default), returns an example "FIXED_LINE" number. Returns an empty phone number if type is not valid for the provided region.

valid

A logical vector. For each FALSE entry, get_example returns an example invalid number, and type is ignored.

Value

A phone vector.

libphonenumber reference

get_example(): PhoneNumberUtil.getExampleNumberForType(); PhoneNumberUtil.getExampleNumber() if type is NULL or NA; PhoneNumberUtil.getInvalidExampleNumber() if valid is FALSE.

See Also

get_supported_regions() for valid region codes, get_types_for_region() to get valid phone types for a region.

Other phone functions: dialr-match, dialr-phone, dialr-region, dialr-type, dialr-valid, dialr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Get a basic example number
get_example("AU")

# Get an example mobile number
get_example("AU", type = "MOBILE")

# Example phone number for an invalid type
get_example("AU", type = "VOICEMAIL")

# Get an example invalid number
get_example("AU", valid = FALSE)

# Get a combination of the previous examples
get_example(c("AU", "AU",     "AU",        "AU" ),
            c(NA,   "MOBILE", "VOICEMAIL", NA   ),
            c(TRUE, TRUE,     TRUE,        FALSE))

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