currencyOf {r2country}R Documentation

Fetch the currency of a country

Description

With specified country name or names, get the associated currency

Usage

currencyOf

Format

An object of class list of length 193.

Value

a list containing all countries and their corresponding currency

Examples

# view the searchable countries, return first 6
head(names(currencyOf))

#task 0: check if the currency of spain is included
#should be all in lower case
grep("spain",names(currencyOf), value = TRUE)

#task 1: check the currency of spain
currencyOf$spain

#task 2: check the currency of singapore list
currencyOf$singapore # return a list of singapore
currencyOf$singapore['symbol'] #returns the symbol
currencyOf$singapore['isocode'] #returns the iso code
currencyOf$singapore['fractionalunity'] #returns the fractional unit


#task 3: check currencies of multiple countries
currencyOf[c("slovenia","romania","malaysia")]

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


[Package r2country version 2.0.2.3.1 Index]