Re: [R] Problem with get.hist.quote() in tseries

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Fri 19 Aug 2005 - 22:25:00 EST

There is no head.ts and x[1:10,] has the side effect of converting it from class ts to class matrix. Use window

  window(x, end = start(x)[1]+10)

instead or use

  head(as.zoo(x))

since there is a head.zoo in the 'zoo' package.

On 8/19/05, Ajay Narottam Shah <ajayshah@mayin.org> wrote:
> When using get.hist.quote(), I find the dates are broken. This is with
> R 2.1.1 on Mac OS X `panther'.
>
> > library(tseries)
> Loading required package: quadprog
>
> 'tseries' version: 0.9-27
>
> 'tseries' is a package for time series analysis and computational
> finance.
>
> See 'library(help="tseries")' for details.
>
> > x <- get.hist.quote("^VIX")
> trying URL 'http://chart.yahoo.com/table.csv?s=^VIX&a=0&b=02&c=1991&d=7&e=18&f=2005&g=d&q=q&y=0&z=^VIX&x=.csv'
> Content type 'text/csv' length unknown
> opened URL
> .......... .......... .......... .......... ..........
> .......... .......... .......... .......... ..........
> .......... .......... .......... .......... ..........
>
> downloaded 150Kb
>
> > head(x)
> [1] 26.62 27.93 27.19 NA NA 28.95
> > x[1:10,]
> Open High Low Close
> [1,] 26.62 26.62 26.62 26.62
> [2,] 27.93 27.93 27.93 27.93
> [3,] 27.19 27.19 27.19 27.19
> [4,] NA NA NA NA
> [5,] NA NA NA NA
> [6,] 28.95 28.95 28.95 28.95
> [7,] 30.38 30.38 30.38 30.38
> [8,] 33.30 33.30 33.30 33.30
> [9,] 31.33 31.33 31.33 31.33
> [10,] 32.63 32.63 32.63 32.63
> > plot(x)
> (dates don't show).
> > str(x)
> mts [1:5343, 1:4] 26.6 27.9 27.2 NA NA ...
> - attr(*, "dimnames")=List of 2
> ..$ : NULL
> ..$ : chr [1:4] "Open" "High" "Low" "Close"
> - attr(*, "tsp")= num [1:3] 33240 38582 1
> - attr(*, "class")= chr [1:2] "mts" "ts"
>
> I wonder what I'm doing wrong.
>
> --
> Ajay Shah Consultant
> ajayshah@mayin.org Department of Economic Affairs
> http://www.mayin.org/ajayshah Ministry of Finance, New Delhi
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Aug 19 22:35:56 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:33:44 EST