Exercise

Import well-formatted OHLC daily data from text file

Sometimes you need to import data from other software, and it is often easiest to write the data to CSV because almost all software can write data to a text file.

You can use getSymbols() to import the CSV if the data are well-formatted. In this case, well-formatted means the file contains data for a single instrument with date, open, high, low, close, volume, and adjusted close columns, in that order. You might have noticed that this is the same format as getSymbols() returns when you download data from Yahoo Finance or Google Finance.

getSymbols() allows you to use a directory of CSV files as a source (like Yahoo Finance and FRED). In this exercise, you will be using AMZN.csv in your working directory. It contains some randomized Amazon.com data from the first half of 2002. You can see the file in your working directory by using dir().