dialr-valid: Phone number validity checks

Description Usage Arguments Details libphonenumber reference See Also Examples

Description

For each element of x:

Usage

1
2
3
4
5
is_parsed(x)

is_valid(x)

is_possible(x, detailed = FALSE, type = NULL)

Arguments

x

A phone vector.

detailed

If FALSE, is_possible returns a logical vector. If TRUE, it returns a character vector with "IS_POSSIBLE" or the reason for failure. See Details section for possible return values.

type

If provided, checks if x is possible for the given phone number type.

Details

Possible return values for is_possible(x, detailed = TRUE):

libphonenumber reference

is_valid(): PhoneNumberUtil.isValidNumber()

is_possible(): PhoneNumberUtil.isPossibleNumber()

is_possible(detailed = TRUE): PhoneNumberUtil.isPossibleNumberWithReason()

is_possible(type = type): PhoneNumberUtil.isPossibleNumberForType()

is_possible(detailed = TRUE, type = type): PhoneNumberUtil.sPossibleNumberForTypeWthReason()

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  x <- phone(c(0, 0123, "0412 345 678", "61412987654", "03 9123 4567", "+12015550123"), "AU")

  is_parsed(x)
  is_valid(x)

  is_possible(x)
  is_possible(x, detailed = TRUE)

  is_possible(x, type = "MOBILE")
  is_possible(x, detailed = TRUE, type = "MOBILE")

Example output

OpenJDK 64-Bit Server VM warning: Can't detect primordial thread stack location - find_vma failed
[1] FALSE  TRUE  TRUE  TRUE  TRUE  TRUE
[1] FALSE FALSE  TRUE  TRUE  TRUE  TRUE
[1] FALSE FALSE  TRUE  TRUE  TRUE  TRUE
[1] NA            "TOO_SHORT"   "IS_POSSIBLE" "IS_POSSIBLE" "IS_POSSIBLE"
[6] "IS_POSSIBLE"
[1] FALSE FALSE  TRUE  TRUE  TRUE  TRUE
[1] NA            "TOO_SHORT"   "IS_POSSIBLE" "IS_POSSIBLE" "IS_POSSIBLE"
[6] "IS_POSSIBLE"

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