Skip to contents

This function is used to execute a query to clio-infra, and returns a data.frame containing the required variables, countries and years specified by the user.

Usage

clio_get(
  variables,
  countries,
  from,
  to,
  list = FALSE,
  mergetype = dplyr::full_join
)

Arguments

variables

The variables you want to obtain (provided to you by Clio::clio_overview())

countries

If left empty, all countries.

from

Start year

to

End year

list

Defaults to FALSE. If TRUE, returns a list of each variable

mergetype

Defaults to full_join. Can be set to inner_join, outer_join, left_join, etc.

Value

A data.frame containing the required variables, countries and years specified by the user.

See also

Clio::clio_get_cat() if you want to extract data by categories instead of by variables.

Examples

clio_get(c("infant mortality", "zinc production"))
#> Joining with `by = join_by(ccode, country.name, year)`
#> # A tibble: 14,570 × 5
#>    ccode country.name    year `Infant Mortality` `Zinc Production`
#>    <dbl> <chr>          <dbl>              <dbl>             <dbl>
#>  1   191 Croatia         1810               175                 NA
#>  2   246 Finland         1810               200.                 0
#>  3   826 United Kingdom  1810               141                  0
#>  4    40 Austria         1820               188.                 0
#>  5   191 Croatia         1820               150                 NA
#>  6   246 Finland         1820               198.                 0
#>  7   250 France          1820               182                  0
#>  8   528 Netherlands     1820               179                 NA
#>  9   826 United Kingdom  1820               153                  0
#> 10    40 Austria         1830               251.                 0
#> # ℹ 14,560 more rows

clio_get(c("biodiversity - naturalness", "xecutive Constraints  (XCONST)"),
from = 1850, to = 1900,
countries = c("Armenia", "Azerbaijan"))
#> Joining with `by = join_by(ccode, country.name, year)`
#> # A tibble: 12 × 5
#>    ccode country.name  year `Biodiversity - naturalness` Executive Constraints…¹
#>    <dbl> <chr>        <dbl>                        <dbl>                   <dbl>
#>  1    51 Armenia       1850                        0.903                      NA
#>  2    31 Azerbaijan    1850                        0.908                      NA
#>  3    51 Armenia       1860                        0.899                      NA
#>  4    31 Azerbaijan    1860                        0.900                      NA
#>  5    51 Armenia       1870                        0.896                      NA
#>  6    31 Azerbaijan    1870                        0.892                      NA
#>  7    51 Armenia       1880                        0.892                      NA
#>  8    31 Azerbaijan    1880                        0.883                      NA
#>  9    51 Armenia       1890                        0.888                      NA
#> 10    31 Azerbaijan    1890                        0.873                      NA
#> 11    51 Armenia       1900                        0.884                      NA
#> 12    31 Azerbaijan    1900                        0.863                      NA
#> # ℹ abbreviated name: ¹​`Executive Constraints  (XCONST)`

clio_get(c("Zinc production", "Gold production"),
from = 1800, to = 1920,
countries = c("Botswana", "Zimbabwe",
             mergetype = dplyr::inner_join))
#> Joining with `by = join_by(ccode, country.name, year)`
#> # A tibble: 242 × 5
#>    ccode country.name  year `Zinc Production` `Gold Production`
#>    <dbl> <chr>        <dbl>             <dbl>             <dbl>
#>  1    72 Botswana      1800                NA                 0
#>  2   716 Zimbabwe      1800                NA                 0
#>  3    72 Botswana      1801                NA                 0
#>  4   716 Zimbabwe      1801                NA                 0
#>  5    72 Botswana      1802                NA                 0
#>  6   716 Zimbabwe      1802                NA                 0
#>  7    72 Botswana      1803                NA                 0
#>  8   716 Zimbabwe      1803                NA                 0
#>  9    72 Botswana      1804                NA                 0
#> 10   716 Zimbabwe      1804                NA                 0
#> # ℹ 232 more rows