Skip to contents

Obtain country data matching language first one or more letters

Usage

byContinent(
  name = c("asia", "europe", "africa", "north america", "south america", "oceania"),
  full.list = TRUE
)

Arguments

name

name of continent

full.list

whether to return only name of country or full list

Value

country data list matching continent

Details

Note that choices for names of continent includes 'asia','europe','africa','north america','south america','oceania'

Examples

# 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)
#>  [1] "Algeria"                  "Angola"                  
#>  [3] "Benin"                    "Botswana"                
#>  [5] "Burkina Faso"             "Burundi"                 
#>  [7] "Cape Verde"               "Cameroon"                
#>  [9] "Central African Republic" "Chad"                    
#> [11] "Comoros"                  "DR Congo"                
#> [13] "Congo"                    "Côte d'Ivoire"           
#> [15] "Djibouti"                 "Egypt"                   
#> [17] "Equatorial Guinea"        "Eritrea"                 
#> [19] "Eswatini"                 "Ethiopia"                
#> [21] "Gabon"                    "Gambia"                  
#> [23] "Ghana"                    "Guinea"                  
#> [25] "Guinea-Bissau"            "Kenya"                   
#> [27] "Lesotho"                  "Liberia"                 
#> [29] "Libya"                    "Madagascar"              
#> [31] "Malawi"                   "Mali"                    
#> [33] "Mauritania"               "Mauritius"               
#> [35] "Morocco"                  "Mozambique"              
#> [37] "Namibia"                  "Niger"                   
#> [39] "Nigeria"                  "Rwanda"                  
#> [41] "Saint Helena"             "Sao Tome & Principe"     
#> [43] "Senegal"                  "Seychelles"              
#> [45] "Sierra Leone"             "Somalia"                 
#> [47] "South Africa"             "South Sudan"             
#> [49] "Sudan"                    "Tanzania"                
#> [51] "Togo"                     "Tunisia"                 
#> [53] "Uganda"                   "Zambia"                  
#> [55] "Zimbabwe"                

# task 2: get only names of countries that contains with "ASIA" or "asia"
byContinent("asia", full.list = FALSE)
#>  [1] "Afghanistan"          "Armenia"              "Azerbaijan"          
#>  [4] "Bahrain"              "Bangladesh"           "Bhutan"              
#>  [7] "Brunei"               "Cambodia"             "China"               
#> [10] "East Timor"           "Georgia"              "Hong Kong"           
#> [13] "India"                "Indonesia"            "Iran"                
#> [16] "Iraq"                 "Israel"               "Japan"               
#> [19] "Jordan"               "Kazakhstan"           "Kuwait"              
#> [22] "Kyrgyzstan"           "Laos"                 "Lebanon"             
#> [25] "Macau"                "Malaysia"             "Maldives"            
#> [28] "Mongolia"             "Myanmar"              "Nepal"               
#> [31] "North Korea"          "Oman"                 "Pakistan"            
#> [34] "Philippines"          "Qatar"                "Russia"              
#> [37] "Saudi Arabia"         "Singapore"            "South Korea"         
#> [40] "Sri Lanka"            "Palestine"            "Syria"               
#> [43] "Taiwan"               "Tajikistan"           "Thailand"            
#> [46] "Turkey"               "Turkmenistan"         "United Arab Emirates"
#> [49] "Uzbekistan"           "Vietnam"              "Yemen"               

# task 3: repeat task 2, but return full list for each country
byContinent("europe", full.list = TRUE)
#> $`1`
#>      name continent
#> 2 Albania    Europe
#> 
#> $`2`
#>      name continent
#> 4 Andorra    Europe
#> 
#> $`3`
#>       name continent
#> 10 Austria    Europe
#> 
#> $`4`
#>       name continent
#> 17 Belarus    Europe
#> 
#> $`5`
#>       name continent
#> 18 Belgium    Europe
#> 
#> $`6`
#>                      name continent
#> 23 Bosnia and Herzegovina    Europe
#> 
#> $`7`
#>        name continent
#> 27 Bulgaria    Europe
#> 
#> $`8`
#>       name continent
#> 44 Croatia    Europe
#> 
#> $`9`
#>      name continent
#> 46 Cyprus    Europe
#> 
#> $`10`
#>              name continent
#> 47 Czech Republic    Europe
#> 
#> $`11`
#>       name continent
#> 48 Denmark    Europe
#> 
#> $`12`
#>       name continent
#> 58 Estonia    Europe
#> 
#> $`13`
#>              name continent
#> 61 Faeroe Islands    Europe
#> 
#> $`14`
#>       name continent
#> 64 Finland    Europe
#> 
#> $`15`
#>      name continent
#> 65 France    Europe
#> 
#> $`16`
#>       name     continent
#> 68 Georgia Europe & Asia
#> 
#> $`17`
#>       name continent
#> 69 Germany    Europe
#> 
#> $`18`
#>         name continent
#> 71 Gibraltar    Europe
#> 
#> $`19`
#>      name continent
#> 72 Greece    Europe
#> 
#> $`20`
#>       name continent
#> 81 Hungary    Europe
#> 
#> $`21`
#>       name continent
#> 82 Iceland    Europe
#> 
#> $`22`
#>       name continent
#> 87 Ireland    Europe
#> 
#> $`23`
#>           name continent
#> 88 Isle of Man    Europe
#> 
#> $`24`
#>     name continent
#> 90 Italy    Europe
#> 
#> $`25`
#>      name continent
#> 96 Kosovo    Europe
#> 
#> $`26`
#>       name continent
#> 100 Latvia    Europe
#> 
#> $`27`
#>              name continent
#> 105 Liechtenstein    Europe
#> 
#> $`28`
#>          name continent
#> 106 Lithuania    Europe
#> 
#> $`29`
#>           name continent
#> 107 Luxembourg    Europe
#> 
#> $`30`
#>      name continent
#> 114 Malta    Europe
#> 
#> $`31`
#>        name continent
#> 118 Moldova    Europe
#> 
#> $`32`
#>       name continent
#> 119 Monaco    Europe
#> 
#> $`33`
#>           name continent
#> 121 Montenegro    Europe
#> 
#> $`34`
#>            name continent
#> 127 Netherlands    Europe
#> 
#> $`35`
#>                name continent
#> 133 North Macedonia    Europe
#> 
#> $`36`
#>       name continent
#> 134 Norway    Europe
#> 
#> $`37`
#>       name continent
#> 141 Poland    Europe
#> 
#> $`38`
#>         name continent
#> 142 Portugal    Europe
#> 
#> $`39`
#>        name continent
#> 144 Romania    Europe
#> 
#> $`40`
#>       name     continent
#> 145 Russia Europe & Asia
#> 
#> $`41`
#>           name continent
#> 151 San Marino    Europe
#> 
#> $`42`
#>       name continent
#> 155 Serbia    Europe
#> 
#> $`43`
#>         name continent
#> 159 Slovakia    Europe
#> 
#> $`44`
#>         name continent
#> 160 Slovenia    Europe
#> 
#> $`45`
#>      name continent
#> 165 Spain    Europe
#> 
#> $`46`
#>       name continent
#> 170 Sweden    Europe
#> 
#> $`47`
#>            name continent
#> 171 Switzerland    Europe
#> 
#> $`48`
#>       name     continent
#> 180 Turkey Europe & Asia
#> 
#> $`49`
#>        name continent
#> 183 Ukraine    Europe
#> 
#> $`50`
#>               name continent
#> 185 United Kingdom    Europe
#>