Learn R Programming

comtradr (version 0.0.2)

ct_csv_data: UN Comtrade data extraction via CSV

Description

Function makes an API call to UN Comtrade, data is returned from the API as a CSV object. Return value of this function is a list containing the data as a dataframe and information on whether the connection to the API was successful, and whether or not data was returned from the API. For use with the UN Comtrade API, full API docs can be found at https://comtrade.un.org/data/doc/api/

Usage

ct_csv_data(url, colname)

Arguments

url

Complete url string of the call to the API.

colname

Indication as to whether to use "human friendly" col names or "machine friendly" col names. Value will be either "H" or "M".

Value

List of length three, elements are:

  • msg: Brief message on whether data was returned.

  • details: Further details related to the nature of the API return.

  • data: Dataframe object of return data.