convert_currency: Function to convert between two currencies

Description Usage Arguments Details Value

View source: R/convert_currency.R

Description

convert_currency produces an exchange rate between two currencies for a specified date range.

Usage

1
2
3
4
5
6
convert_currency(
  currency_from = "USD",
  currency_to = "CAD",
  start_date,
  end_date
)

Arguments

currency_from, currency_to

A character scalar indicating the currency to be converted from or to. Valid country codes can be found using the function fixerapi::fixer_symbols.

start_date, end_date

A date or a character string which can be coerced to a date. A date range will be constructed from the first day of the month in which 'start_date' is located and the last day of the month in which 'end_date' is located.

Details

A function for producing an exchange rate for two countries' currencies over a specified period of time. The function uses the fixer.io currency conversion service, and relies on the fixerapi package, which must be separately installed. A fixer.io API key must also be supplied, either through the fixerapi::fixer_api_key function or by adding the key as a FIXER_API_KEY variable in .Renviron.

Value

A table with two columns: 'year_month' and 'exchange_rate'.


UPGo-McGill/upgo documentation built on Nov. 20, 2021, 2:26 a.m.