Title: | Country Data with Names, Capitals, Currencies, Populations, Time, Languages and so on |
---|---|
Description: | Obtain information about countries around the globe. Information for names, states, languages, time, capitals, currency and many more. Data source are 'Wikipedia' <https://www.wikipedia.org>, 'TimeAndDate' <https://www.timeanddate.com> and 'CountryCode' <https://countrycode.org>. |
Authors: | Obinna Obianom [aut, cre] |
Maintainer: | Obinna Obianom <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2.0.2.3.1 |
Built: | 2024-10-30 04:45:45 UTC |
Source: | https://github.com/oobianom/r2country |
Obtain country data matching language first one or more letters
byContinent( name = c("asia", "europe", "africa", "north america", "south america", "oceania"), full.list = TRUE )
byContinent( name = c("asia", "europe", "africa", "north america", "south america", "oceania"), full.list = TRUE )
name |
name of continent |
full.list |
whether to return only name of country or full list |
Note that choices for names of continent includes 'asia','europe','africa','north america','south america','oceania'
country data list matching continent
# task 1: get only names of countries that contains with "africa" or "AFrica" # note that the search in case-insensitive byContinent("africa", full.list = FALSE) # task 2: get only names of countries that contains with "ASIA" or "asia" byContinent("asia", full.list = FALSE) # task 3: repeat task 2, but return full list for each country byContinent("europe", full.list = TRUE)
# task 1: get only names of countries that contains with "africa" or "AFrica" # note that the search in case-insensitive byContinent("africa", full.list = FALSE) # task 2: get only names of countries that contains with "ASIA" or "asia" byContinent("asia", full.list = FALSE) # task 3: repeat task 2, but return full list for each country byContinent("europe", full.list = TRUE)
With specified country name or names, get the associated calling code
callingCodeOf
callingCodeOf
An object of class list
of length 193.
a list containing all countries and their corresponding calling 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")]
# 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")]
With specified country name or names, get the associated capital
capitalOf
capitalOf
An object of class list
of length 193.
a list containing all countries and their corresponding capital
# view the searchable countries, return first 6 head(names(capitalOf)) #task 0: check if the capital of japan is included #should be all in lower case grep("japan",names(capitalOf), value = TRUE) #task 1: check the capital of nigeria capitalOf$nigeria #task 2: check the capital of united states capitalOf$`united states` #task 3: check capital of multiple countries capitalOf[c("slovenia","romania","malaysia")] #task 4: what if the capital is not available capitalOf[c("randomcountry","mexico","luxembourg")]
# view the searchable countries, return first 6 head(names(capitalOf)) #task 0: check if the capital of japan is included #should be all in lower case grep("japan",names(capitalOf), value = TRUE) #task 1: check the capital of nigeria capitalOf$nigeria #task 2: check the capital of united states capitalOf$`united states` #task 3: check capital of multiple countries capitalOf[c("slovenia","romania","malaysia")] #task 4: what if the capital is not available capitalOf[c("randomcountry","mexico","luxembourg")]
Dataset containing time different in various cities with respect to USA/New York time
data(city_time)
data(city_time)
A data frame with the current time in various cities
Names of cities
Time difference relative to New York time
cities and the current time relative to New York
Internal data consisting of cities and their corresponding time
# load the cities and languages dataset data(city_time) # view content of the city-language data head(city_time)
# load the cities and languages dataset data(city_time) # view content of the city-language data head(city_time)
Get the continent that a particular country belongs to
continentOf
continentOf
An object of class list
of length 193.
a list containing all countries and corresponding continents
# view the searchable countries, return first 15 names(continentOf)[1:15] #task 1: view the continent of algeria continentOf$algeria #task 2: view the continent of nigeria continentOf$nigeria #task 3: view the continent of multiple countries continentOf[c("niger","china","colombia")] #task 4: if the continent is not available continentOf[c("niger","china","randomtest")]
# view the searchable countries, return first 15 names(continentOf)[1:15] #task 1: view the continent of algeria continentOf$algeria #task 2: view the continent of nigeria continentOf$nigeria #task 3: view the continent of multiple countries continentOf[c("niger","china","colombia")] #task 4: if the continent is not available continentOf[c("niger","china","randomtest")]
Fetch the names of all countries
countries
countries
An object of class character
of length 193.
Names of all countries in the globe
# list all the countries countries # list only 5 countries countries[1:5] # create a dataset with all countries of the world data.frame(ID = quickcode::number(length(countries)), Names = countries)
# list all the countries countries # list only 5 countries countries[1:5] # create a dataset with all countries of the world data.frame(ID = quickcode::number(length(countries)), Names = countries)
Fetch the names of all countries in upper case
COUNTRIES
COUNTRIES
An object of class character
of length 193.
Names of all countries in the globe in upper case
# list all the countries COUNTRIES # list only 5 countries COUNTRIES[1:5] # create a dataset with all countries of the world data.frame(ID = 1, Names = COUNTRIES)
# list all the countries COUNTRIES # list only 5 countries COUNTRIES[1:5] # create a dataset with all countries of the world data.frame(ID = 1, Names = COUNTRIES)
Dataset containing country IDs and their calling code
data(country_calling_code)
data(country_calling_code)
A data frame with the calling code of countries
country identifiers
Calling code of countries
calling code of countries
Internal data consisting of countries and their calling code
Data country_names
for linkage of IDs with country calling code
# load the calling code dataset data(country_calling_code) # view content of the city-calling code data head(country_calling_code)
# load the calling code dataset data(country_calling_code) # view content of the city-calling code data head(country_calling_code)
Dataset containing country IDs and their capitals
data(country_capital)
data(country_capital)
A data frame with the capitals that countries belong to
country identifiers
capitals of various country
corresponding capitals of countries
Internal data consisting of countries and their capital
Data country_names
for linkage of IDs with capital
# load the capitals dataset data(country_capital) data(country_names) finaldb <- cbind(country_names,country_capital) # view content of the country and population head(finaldb)
# load the capitals dataset data(country_capital) data(country_names) finaldb <- cbind(country_names,country_capital) # view content of the country and population head(finaldb)
Dataset containing country IDs and their continents
data(country_continent)
data(country_continent)
A data frame with the continents that countries belong to
country identifiers
continents of various country
corresponding continents of countries
Internal data consisting of countries and their continent
Data country_names
for linkage of IDs with continent
# load the continent dataset data(country_continent) data(country_names) finaldb <- cbind(country_names,country_continent) # view content of the country and population head(finaldb)
# load the continent dataset data(country_continent) data(country_names) finaldb <- cbind(country_names,country_continent) # view content of the country and population head(finaldb)
Data for all countries and their associated languages
data(country_language)
data(country_language)
A data frame with the languages of countries
Identifier for the countries
official languages of countries
country ID and official languages
Internal data consisting of all country IDs and their official languages
Data country_names
for linkage of IDs with country names
# load the country ID and languages data(country_language) # view content of the countries languages head(country_language)
# load the country ID and languages data(country_language) # view content of the countries languages head(country_language)
Data for all country currency names and symbols
data(country_money)
data(country_money)
A data frame with all countries and columns for currency
Identifier for countries
name of the currency
symbol of the currency
The ISO code of the currency
The fractional unit of the currency
data for currencies by country
Internal data for currencies belonging to every country
country_names
for linkage of IDs with country names
data(country_money) # view content of the countries currency head(country_money)
data(country_money) # view content of the countries currency head(country_money)
Data for all country currency names and associated ID
data(country_names)
data(country_names)
A data frame with the names of all countries
Identifier for the countries
name of the countries
data for names of country
Internal data consisting of all country names
# load the country names data(country_names) # view content of the countries currency head(country_names)
# load the country names data(country_names) # view content of the countries currency head(country_names)
Dataset containing country IDs and their population by year
data(country_population)
data(country_population)
A data frame with the population of countries
country identifiers
country population as of 2023
corresponding population size of countries
Internal data consisting of countries and their population
Data country_names
for linkage of IDs with country population size
# load the population dataset data(country_population) data(country_names) finaldb <- cbind(country_names,country_population) # view content of the country and population head(finaldb)
# load the population dataset data(country_population) data(country_names) finaldb <- cbind(country_names,country_population) # view content of the country and population head(finaldb)
Subset and return countries given a specified characters to search
countryEndsWith(char, full.list = TRUE)
countryEndsWith(char, full.list = TRUE)
char |
character to search for |
full.list |
whether to return only name of country or full list |
country data list matching a specified character
[countryStartsWith()] for country search starting with specified characters, and [countryHas()] for countries that contain specified characters.
# task 1: get only names of countries that end with "A" or "a" # note that the search in case-insensitive countryEndsWith("A", full.list = FALSE) # task 2: get only names of countries that end with "No" or "no" countryEndsWith("no", full.list = FALSE) # task 3: repeat task 2, but return full list for each country countryEndsWith("no")
# task 1: get only names of countries that end with "A" or "a" # note that the search in case-insensitive countryEndsWith("A", full.list = FALSE) # task 2: get only names of countries that end with "No" or "no" countryEndsWith("no", full.list = FALSE) # task 3: repeat task 2, but return full list for each country countryEndsWith("no")
Subset to obtain data for countries containing specified characters to search
countryHas(char, full.list = TRUE)
countryHas(char, full.list = TRUE)
char |
character to search for |
full.list |
whether to return only name of country or full list |
country data list matching content from a specified character
countryStartsWith
for country search starting with specified characters, and [countryEndsWith()] for countries that end with a specified characters.
# task 1: get only names of countries that contains with "ER" or "er" # note that the search in case-insensitive countryHas("er", full.list = FALSE) # task 2: get only names of countries that contains with "LAND" or "lAND" or "land" countryHas("lAND", full.list = FALSE) # task 3: repeat task 2, but return full list for each country countryHas("many", full.list = TRUE)
# task 1: get only names of countries that contains with "ER" or "er" # note that the search in case-insensitive countryHas("er", full.list = FALSE) # task 2: get only names of countries that contains with "LAND" or "lAND" or "land" countryHas("lAND", full.list = FALSE) # task 3: repeat task 2, but return full list for each country countryHas("many", full.list = TRUE)
Subset and return countries given a specified characters to search
countryStartsWith(char, full.list = TRUE)
countryStartsWith(char, full.list = TRUE)
char |
character to search for |
full.list |
whether to return only name of country or full list |
country data list matching a specified character
[countryEndsWith()] for country search ending in specified character, and [countryHas()] for countries that contain specified characters.
# task 1: get only names of countries that start with "A" or "a" # note that the search in case-insensitive countryStartsWith("A", full.list = FALSE) # task 2: get only names of countries that start with "No" or "no" countryStartsWith("no", full.list = FALSE) # task 3: repeat task 2, but return full list for each country countryStartsWith("no")
# task 1: get only names of countries that start with "A" or "a" # note that the search in case-insensitive countryStartsWith("A", full.list = FALSE) # task 2: get only names of countries that start with "No" or "no" countryStartsWith("no", full.list = FALSE) # task 3: repeat task 2, but return full list for each country countryStartsWith("no")
With specified country name or names, get the associated currency
currencyOf
currencyOf
An object of class list
of length 193.
a list containing all countries and their corresponding currency
# 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")]
# 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")]
Obtain country data matching language first one or more letters
languageEndsWith(char, full.list = TRUE)
languageEndsWith(char, full.list = TRUE)
char |
character to search in languages |
full.list |
whether to return only name of country or full list |
language list or country data list matching parts of a character search on languages
countryStartsWith
for country search starting with specified characters, and [countryEndsWith()] for countries that end with a specified characters.
# task 1: get only language names that ends with "EN" or "en" # note that the search in case-insensitive languageEndsWith("eN", full.list = FALSE) # task 2: get only language names that ends with "chi" languageEndsWith("chi", full.list = FALSE) # task 3: repeat task 2, but return full list for each country with the language languageEndsWith("sin", full.list = TRUE) # searching text with no results languageEndsWith("er", full.list = FALSE)
# task 1: get only language names that ends with "EN" or "en" # note that the search in case-insensitive languageEndsWith("eN", full.list = FALSE) # task 2: get only language names that ends with "chi" languageEndsWith("chi", full.list = FALSE) # task 3: repeat task 2, but return full list for each country with the language languageEndsWith("sin", full.list = TRUE) # searching text with no results languageEndsWith("er", full.list = FALSE)
Obtain country data matching language first one or more letters
languageHas(char, full.list = TRUE)
languageHas(char, full.list = TRUE)
char |
character to search for |
full.list |
whether to return only name of country or full list |
country data list matching content from a specified character
countryStartsWith
for country search starting with specified characters, and [countryEndsWith()] for countries that end with a specified characters.
# task 1: get only names of countries that contains with "ER" or "er" # note that the search in case-insensitive countryHas("er", full.list = FALSE) # task 2: get only names of countries that contains with "LAND" or "lAND" or "land" countryHas("lAND", full.list = FALSE) # task 3: repeat task 2, but return full list for each country countryHas("many", full.list = TRUE)
# task 1: get only names of countries that contains with "ER" or "er" # note that the search in case-insensitive countryHas("er", full.list = FALSE) # task 2: get only names of countries that contains with "LAND" or "lAND" or "land" countryHas("lAND", full.list = FALSE) # task 3: repeat task 2, but return full list for each country countryHas("many", full.list = TRUE)
With specified country name or names, get the associated official language(s)
languageOf
languageOf
An object of class list
of length 193.
a list containing all countries and their corresponding language
# view the searchable countries, return first 6 head(names(languageOf)) #task 0: check if the language of japan is included #should be all in lower case grep("japan",names(languageOf), value = TRUE) #task 1: check the language of nigeria languageOf$nigeria #task 2: check the language of united states languageOf$`united states` #task 3: check language of multiple countries languageOf[c("slovenia","romania","malaysia")] #task 4: what if the language is not available languageOf[c("randomcountry","mexico","luxembourg")]
# view the searchable countries, return first 6 head(names(languageOf)) #task 0: check if the language of japan is included #should be all in lower case grep("japan",names(languageOf), value = TRUE) #task 1: check the language of nigeria languageOf$nigeria #task 2: check the language of united states languageOf$`united states` #task 3: check language of multiple countries languageOf[c("slovenia","romania","malaysia")] #task 4: what if the language is not available languageOf[c("randomcountry","mexico","luxembourg")]
Obtain country data matching language first one or more letters
languageStartsWith(char, full.list = TRUE)
languageStartsWith(char, full.list = TRUE)
char |
character to search in languages |
full.list |
whether to return only name of country or full list |
language list or country data list matching parts of a character search on languages
countryStartsWith
for country search starting with specified characters, and [countryEndsWith()] for countries that end with a specified characters.
# task 1: get only language names that ends with "EN" or "en" # note that the search in case-insensitive languageStartsWith("eN", full.list = FALSE) # task 2: get only language names that ends with "chi" languageStartsWith("chi", full.list = FALSE) # task 3: repeat task 2, but return full list for each country with the language languageStartsWith("sin", full.list = TRUE) # searching text with no results languageStartsWith("er", full.list = FALSE)
# task 1: get only language names that ends with "EN" or "en" # note that the search in case-insensitive languageStartsWith("eN", full.list = FALSE) # task 2: get only language names that ends with "chi" languageStartsWith("chi", full.list = FALSE) # task 3: repeat task 2, but return full list for each country with the language languageStartsWith("sin", full.list = TRUE) # searching text with no results languageStartsWith("er", full.list = FALSE)
With specified country name or names, get the associated population
populationOf
populationOf
An object of class list
of length 193.
a list containing all countries and their corresponding population
# view the searchable countries, return first 6 head(names(populationOf)) #task 0: check if the population of japan is included #should be all in lower case grep("japan",names(populationOf), value = TRUE) #task 1: check the population of nigeria populationOf$nigeria #task 2: check the population of united states populationOf$`united states` #task 3: check population of multiple countries populationOf[c("slovenia","romania","malaysia")] #task 4: what if the population is not available populationOf[c("randomcountry","mexico","luxembourg")]
# view the searchable countries, return first 6 head(names(populationOf)) #task 0: check if the population of japan is included #should be all in lower case grep("japan",names(populationOf), value = TRUE) #task 1: check the population of nigeria populationOf$nigeria #task 2: check the population of united states populationOf$`united states` #task 3: check population of multiple countries populationOf[c("slovenia","romania","malaysia")] #task 4: what if the population is not available populationOf[c("randomcountry","mexico","luxembourg")]
Get the current time using specified city name
timeIn
timeIn
An object of class list
of length 2226.
a list containing all cities and corresponding local time
# view the searchable cities, return first 10 names(timeIn)[1:10] #task 0: check if the time in Delhi is present #should be all in lower case grep("delhi",names(timeIn), value = TRUE) #task 1: check the time in delhi timeIn$`india, delhi, new delhi` #task 2: check the time in Boston timeIn$`usa, massachusetts, boston` #task 3: view the time in multiple countries timeIn[c( "china, zhejiang, hangzhou", "nigeria, kano, kano", "usa, texas, garland" )] #task 4: what if the city is not available timeIn[c("randomcity","york","jerusalem")]
# view the searchable cities, return first 10 names(timeIn)[1:10] #task 0: check if the time in Delhi is present #should be all in lower case grep("delhi",names(timeIn), value = TRUE) #task 1: check the time in delhi timeIn$`india, delhi, new delhi` #task 2: check the time in Boston timeIn$`usa, massachusetts, boston` #task 3: view the time in multiple countries timeIn[c( "china, zhejiang, hangzhou", "nigeria, kano, kano", "usa, texas, garland" )] #task 4: what if the city is not available timeIn[c("randomcity","york","jerusalem")]