Learn R Programming

oec (version 2.5.2)

getdata_interval: Downloads and processes the data from the API

Description

Downloads and processes the data from the API

Usage

getdata_interval(origin, dest, initial_year, final_year, classification,
  interval)

Arguments

origin

Country code of origin (e.g. "chl" for Chile)

dest

Country code of destination (e.g. "chn" for China)

initial_year

The OEC's API ranges from 1942 to 2016. This needs to be lower than `final_year`

final_year

The OEC's API ranges from 1942 to 2016. This needs to be greater than `initial_year`

classification

Trade classification that can be "1" (HS92 4 characters since year 1995), "2" (SITC rev.2 4 characters since year 1962) or "3" (HS92 6 characters since year 1995)

interval

is an optional parameter to define the distance between years (by default set to 1)

Examples

Run this code
# NOT RUN {
# Run countries_list() to display the full list of countries
# For the example Chile is "chl" and China is "chn"
# Download trade between Chile and China
# Years 2010-2016 (HS92 4 characters)
# getdata_interval("chl", "chn", 2010, 2016)
# getdata_interval("chl", "chn", 2010, 2016, 1, 1) # equivalent to last command

# Download trade between Chile and China
# Years 2010, 2012 and 2014 from OEC's API (HS92 4 characters)
# getdata_interval("chl", "chn", 2010, 2014, 1, 2)

# Download trade between Chile and China
# Years 2010, 2012 and 2014 from OEC's API (SITC rev2 4 characters)
# getdata_interval("chl", "chn", 2010, 2014, 2, 2)

# Download trade between Chile and China
# Years 2010, 2012 and 2014 from OEC's API (HS92 6 characters)
# getdata_interval("chl", "chn", 2010, 2014, 3, 2)
# }

Run the code above in your browser using DataLab