Learn R Programming

detector (version 0.1.0)

is_phone_number: Test if a string is a phone number.

Description

Strictly works for only US phone numbers.

Usage

is_phone_number(.x)

Arguments

.x
A string or numeric vector.

Value

A logical value indicating if that string is a phone number.

Examples

Run this code
# Examples
is_phone_number("hello") # FALSE
is_phone_number(65884) # FALSE
is_phone_number("111-333-5555") # TRUE
is_phone_number(1113335555) # TRUE

Run the code above in your browser using DataLab