get_smarter_countries: Get SMARTER Countries

View source: R/countries.R

get_smarter_countriesR Documentation

Get SMARTER Countries

Description

Fetch SMARTER REST API countries endpoint and returns results in a dataframe. Cached token is used or a new token is generated if not provided when calling this function (see get_smarter_token for more information)

Usage

get_smarter_countries(query = list(), token = NULL)

Arguments

query

a list of query arguments

token

a string with a valid token

Value

Returns a dataframe with selected countries

Passing additional parameters

Contries endpoint supports additional parameters when making queries. Additional parameters need to be passed as list using the query parameter. For example, to get all the countries where there are "Sheeps" you need to provide list(species="Sheep") as query parameter. Endpoint supports searches with two or tree ISO codes using alpha_2 and alpha3 parameters respectively. In addition, you can search using a pattern through the search parameter. See Swagger Countries endpoint for more information about the breeds endpoint

Examples

italy <- get_smarter_countries(query = list(name = "Italy"))
france <- get_smarter_countries(query = list(alpha_2 = "FR"))

## Not run: 
# get countries where there are sheeps
sheep_countries <- get_smarter_countries(query = list(species = "Sheep"))

## End(Not run)


cnr-ibba/r-smarter-api documentation built on Nov. 1, 2022, 4:24 a.m.