An R package to test your skills in world geography.
You can install this package from Github.
### First install the devtools package (if not already installed)
install.packages('devtools')
### Then install the geographr package
library(devtools)
devtools::install_github('ahasverus/geographr')
### And load the package
library(geographr)
The geographr
package contains seven main functions. All of these functions are available in two different languages: english (en) and french (fr). English is the default in all the functions.
#### Default settings
learning(region = 'world', lang = 'en')
#### Short version
learning()
#### User settings usage
learning(region = 'south america', lang = 'fr')
#### Get the correct spelling of regions
get_region_name()
get_region_name(lang = 'fr')
#### Get the correct spelling of countries
get_country_name()
get_country_name(lang = 'fr')
#### Default settings
find_country(region = 'europa', lang = 'en')
#### Short version
find_country()
#### User settings usage
find_country(region = 'africa', lang = 'fr')
#### Default settings
find_flag(region = 'world', lang = 'en')
#### Short version
find_flag()
#### User settings usage
find_flag(region = 'asia', lang = 'fr')
#### Default settings (random country)
find_region(country = NULL, lang = 'en')
#### Short version
find_region()
#### User settings usage
find_region(country = 'spain', lang = 'en')
#### Default settings (random country)
find_cities(country = NULL, n = 10, lang = 'en')
#### Short version
find_cities()
#### User settings usage
find_cities(country = 'france', n = 10, lang = 'en')
More than 40,000 towns are available. For instance, one thousand are available for France. But do not overload the map with a too higher number of towns. It will be unclickable...
The argument lang
defines the language of the interface. But it has no impact when you search for a specific region/country: find_cities('spain')
is the same as find_cities('Espagne')
. Moreover search based on region and country is case-insensitive.
At the end of each function, take a look at the R console: some statistics are provided.
Cities and world shapefile come from the maps package. High resolution shapefiles come from GADM.
For a better visual experience, please do not resize graphical windows.
The function find_cities()
needs more development. But it works. Enjoy!
Special thanks to KevCaz and SteveViss for their feedbacks ;)
This package is licensed to you under the terms of the GNU General Public License version 3 or later.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.