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

2005-08-19 Thread Gabor Grothendieck
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 [EMAIL PROTECTED] 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=^VIXa=0b=02c=1991d=7e=18f=2005g=dq=qy=0z=^VIXx=.csv'
 Content type 'text/csv' length unknown
 opened URL
 .. .. .. .. ..
 .. .. .. .. ..
 .. .. .. .. ..
 
 downloaded 150Kb
 
  head(x)
 [1] 26.62 27.93 27.19NANA 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,]NANANANA
  [5,]NANANANA
  [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
 [EMAIL PROTECTED]  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


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

2005-08-18 Thread Ajay Narottam Shah
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=^VIXa=0b=02c=1991d=7e=18f=2005g=dq=qy=0z=^VIXx=.csv'
Content type 'text/csv' length unknown
opened URL
.. .. .. .. ..
.. .. .. .. ..
.. .. .. .. ..

downloaded 150Kb

 head(x)
[1] 26.62 27.93 27.19NANA 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,]NANANANA
 [5,]NANANANA
 [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
[EMAIL PROTECTED]  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