Skip to contents

With specified country name or names, get the associated official language(s)

Usage

languageOf

Format

An object of class list of length 193.

Value

a list containing all countries and their corresponding language

Examples

# view the searchable countries, return first 6
head(names(languageOf))
#> [1] "afghanistan"         "albania"             "algeria"            
#> [4] "andorra"             "angola"              "antigua and barbuda"

#task 0: check if the language of japan is included
#should be all in lower case
grep("japan",names(languageOf), value = TRUE)
#> [1] "japan"

#task 1: check the language of nigeria
languageOf$nigeria
#> [1] "English"

#task 2: check the language of united states
languageOf$`united states`
#> [1] "English"


#task 3: check language of multiple countries
languageOf[c("slovenia","romania","malaysia")]
#> $slovenia
#> [1] "Slovene"
#> 
#> $romania
#> [1] "Romanian"
#> 
#> $malaysia
#> [1] "Malay"
#> 

#task 4: what if the language is not available
languageOf[c("randomcountry","mexico","luxembourg")]
#> $<NA>
#> NULL
#> 
#> $mexico
#> [1] "Spanish"
#> 
#> $luxembourg
#> [1] "French, German, Luxembourgish"
#>