I'm trying to use the zoo package but unfortunately it's showing an error when I try use it.
As a matter of fact, the results that I'm getting are wrong in the last line.
> library(zoo)
Attaching package: ‘zoo’
The following object(s) are masked from ‘package:base’:
as.Date, as.Date.numeric
> library(zoo)
> sbux=read.csv(file="sbuxPrices.csv",header=TRUE)
> dates.sbx = as.yearmon(sbux.df$Date, format="%m/%d/%Y")
> sbux.z=zoo(x=sbux$Adj.Close, order.by=dates.sbx)
> class(sbux.z)
[1] "zoo"
> head(sbux.z)
Jan 0000 Feb 0000 Mar 0000 Apr 0000 May 0000 Jun 0000
7.66 8.41 10.73 7.24 8.14 9.14
EDIT: (1)My data is http://faculty.washington.edu/ezivot/econ424/sbuxPrices.csv and believe there is no problem with it as my lecture note works with it and get the right results. (2) Removed the rstudio tag. I thought that the fact that I'm coding in it made any difference!
Thank you!