Learn R Programming

r2country 2.0.2.4.0 is here !

r2country: Compiled dataset and functions for country names, capitals, languages and so on.

View Rmd Demo: https://r2country.obi.obianom.com/visualizeCountries.html

View Shiny App Demo: https://shinyappstore.com/a/r2country


Quick calls to obtain various country info for use 
in writing R markdown and developing robust applications

Please NOTE that currently the 'timeIn' call may not 
provide 100% accurate result for time in particular places. 
This aspect is being worked on for the next version, so don't fret ! 


Install

install.packages("r2country") 

Use

Get all countries

#load package
library(r2country)

#get countries
countries

#or
#get countries in uppercase
COUNTRIES

Load datasets

data(country_calling_code) # calling code for countries
data(country_population) # population by year for countries
data(city_time) # time by city
data(country_names) # country names
data(country_money) # countries currency
data(country_language) # country language
data(country_capital) #country capitals
data(country_continent)# continent countries

Use functions available

Few examples

#get capital of a country

capitalOf$nigeria #for nigeria
capitalOf$china #for china
capitalOf[c("slovenia","romania","malaysia")] #get multiple capitals

#get offical languages of a country

languageOf$romania #for romania
languageOf$mexico #for mexico
languageOf[c("egypt","united kingdom","taiwan")] #get multiple languages

#get population count of country

populationOf$india #for india
populationOf$brazil #for brazil
populationOf[c("slovenia","ghana","nigeria")] #get multiple countries


#get the current time in a place

grep("usa,",names(timeIn), value = T) #get the available USA regions
timeIn$`usa, california, oakland` #get the current time in Oakland, California

grep("nigeria,",names(timeIn), value = T) #get the available Nigeria regions
timeIn$`nigeria, lagos, lagos` #get the current time in Lagos, Nigeria

# And others...

Get more examples

Copy Link

Version

Install

install.packages('r2country')

Monthly Downloads

168

Version

2.0.2.4.0

License

MIT + file LICENSE

Maintainer

Obinna Obianom

Last Published

August 16th, 2024

Functions in r2country (2.0.2.4.0)

country_calling_code

Dataset of countries and their calling code
populationOf

Fetch the latest population count of a country
r2country-package

r2country: Country Data with Names, Capitals, Currencies, Populations, Time, Languages and so on
currencyOf

Fetch the currency of a country
timeIn

Fetch the current time in a specific city
languageStartsWith

Fetch countries data based on official language prefix
languageOf

Fetch the official language of a country
countryStartsWith

Fetch countries that start with specified characters
countryHas

Fetch countries that contains with specified characters
country_population

Dataset of countries and their latest population
COUNTRIES

Names of all countries in upper case
languageHas

Fetch countries data based on official language prefix
languageEndsWith

Fetch countries data with official language ending in specified character
countryEndsWith

Fetch countries that ends with specified characters
country_capital

Dataset of countries and their capitals
byContinent

Fetch countries by continent
callingCodeOf

Fetch the calling code of a country
capitalOf

Fetch the latest capital of a country
city_time

Dataset of current time in Cities
country_continent

Dataset of countries and their continents
country_language

Dataset of country official languages
country_money

Dataset for Country Currencies
countries

Names of all countries
continentOf

Fetch the continent of a country
country_names

Dataset of country names