populationOf {r2country} | R Documentation |
Fetch the latest population count of a country
Description
With specified country name or names, get the associated population
Usage
populationOf
Format
An object of class list
of length 193.
Value
a list containing all countries and their corresponding population
Examples
# 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")]
[Package r2country version 2.0.2.3.1 Index]