Predicting foreign exchange rates
Our third and final data set will be constructed from a historical database of Euro Foreign Exchange Reference rates provided by the website of the European Central Bank. We can download a zipped archive containing the data from http://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist.zip. When unzipped, this archive contains a file titled eurofxref-hist.csv
, which we can directly import into R using the read.csv()
function:
> eurofxref.hist <- read.csv("eurofxref-hist.csv", stringsAsFactors = F) > eurofxref.hist[1 : 6, 1 : 6] Date USD JPY BGN CYP CZK 1 2014-09-05 1.2948 136.27 1.9558 N/A 27.596 2 2014-09-04 1.3015 136.89 1.9558 N/A 27.662 3 2014-09-03 1.3151 138.11 1.9558 N/A 27.658 4 2014-09-02 1.3115 137.63 1.9558 N/A 27.784 5 2014-09-01 1.3133 136.97 1.9558 N/A 27.738 6 2014-08-29 1.3188 137.11 1.9558 N/A 27.725
As we can see, our data frame contains the conversion rates for several different currencies...