Skip to contents

Get the continent that a particular country belongs to

Usage

continentOf

Format

An object of class list of length 193.

Value

a list containing all countries and corresponding continents

Examples

# view the searchable countries, return first 15
names(continentOf)[1:15]
#>  [1] "afghanistan"         "albania"             "algeria"            
#>  [4] "andorra"             "angola"              "antigua and barbuda"
#>  [7] "argentina"           "anguilla"            "armenia"            
#> [10] "austria"             "australia"           "azerbaijan"         
#> [13] "bahrain"             "bahamas"             "bangladesh"         

#task 1: view the continent of algeria
continentOf$algeria
#> [1] "Africa"

#task 2: view the continent of nigeria
continentOf$nigeria
#> [1] "Africa"

#task 3: view the continent of multiple countries
continentOf[c("niger","china","colombia")]
#> $niger
#> [1] "Africa"
#> 
#> $china
#> [1] "Asia"
#> 
#> $colombia
#> [1] "South America"
#> 

#task 4: if the continent is not available
continentOf[c("niger","china","randomtest")]
#> $niger
#> [1] "Africa"
#> 
#> $china
#> [1] "Asia"
#> 
#> $<NA>
#> NULL
#>