Please help!
I have a .csv file with 4 columns: Date, VBLTX, FMAGX and SBUX. The three latter columns are adjusted closing prices of some stocks. And the date column are the months from Jan-1998 to Dec-2009. Here is the first couple or rows:
Date |VBLTX |FMAGX |SBUX
1/01/1998 |4.36 |44.38 |4.3
1/02/1998 |4.34 |47.74 |4.66
1/03/1998 |4.35 |47.74 |5.33
I am trying to read this into R as a zoo object that should look like this:
|VBLTX |FMAGX |SBUX
Jan 1998 |4.36 |44.38 |4.3
Feb 1998 |4.34 |47.74 |4.66
Mar 1998 |4.35 |47.74 |5.33
I have no idea how to make this work. I am currently using this line of code:
all_prices <- read.zoo("all_prices.csv", FUN = identity)
And this produces this zoo series:
|V2 |V3 |V4
Apr-00 |4.63 |73.15 |7.12
Apr-01 |5.22 |63.05 |9.11
Apr-02 |5.71 |53.88 |10.74
It appears to have sorted the csv file alphabetically rather than by date. Also if I scroll through the zoo series there is a row which is the column names from the csv file.
Any help would be appreciated
Thanks!