Learn R Programming

naijR (version 0.6.1)

fix_mobile: Fix mobile numbers

Description

Fixes up local mobile phone numbers to a uniform text format.

Usage

fix_mobile(x)

Value

The updated vector, usually the column of a data frame.

Arguments

x

A character vector of numerical strings.

Details

This format is specific to that used in a given location - for now the function is useful only for Nigeria mobile numbers, which come in the format expressed by the regex pattern "^0[7-9][0-1][0-9]{8}$".

Examples

Run this code
fix_mobile("803-123-4567")    # Adds leading '0" and removes separators

Run the code above in your browser using DataLab