Learn R Programming

r2country (version 2.0.2.4.0)

callingCodeOf: Fetch the calling code of a country

Description

With specified country name or names, get the associated calling code

Usage

callingCodeOf

Arguments

Value

a list containing all countries and their corresponding calling code

Format

An object of class list of length 193.

Examples

Run this code
# view the searchable countries, return first 6
head(names(callingCodeOf))

#task 0: check if the calling code of japan is included
#should be all in lower case
grep("japan",names(callingCodeOf), value = TRUE)

#task 1: check the calling code of nigeria
callingCodeOf$nigeria

#task 2: check the calling code of united states
callingCodeOf$`united states`


#task 3: check calling code of multiple countries
callingCodeOf[c("slovenia","romania","malaysia")]

#task 4: what if the calling code is not available
callingCodeOf[c("randomcountry","mexico","luxembourg")]

Run the code above in your browser using DataLab