
Last chance! 50% off unlimited learning
Sale ends in
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.
get_example(region, type = NULL, valid = TRUE)
A phone vector.
A character vector of ISO country codes.
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
.
A logical vector. For each FALSE
entry, get_example
returns
an example invalid number, and type
is ignored.
get_example()
: PhoneNumberUtil.getExampleNumberForType()
;
PhoneNumberUtil.getExampleNumber()
if type
is NULL
or NA
;
PhoneNumberUtil.getInvalidExampleNumber()
if valid
is FALSE
.
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
# 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))
Run the code above in your browser using DataLab