[R-SIG-Finance] yahooSeries - how to access the date field?

Moshe Olshansky m_olshansky at yahoo.com
Mon Jul 7 03:12:24 CEST 2008


Try 
rownames(zdata)


--- On Mon, 7/7/08, bina <binabina at bellsouth.net> wrote:

> From: bina <binabina at bellsouth.net>
> Subject: [R-SIG-Finance] yahooSeries - how to access the date field?
> To: r-sig-finance at stat.math.ethz.ch
> Received: Monday, 7 July, 2008, 10:51 AM
> hello, extracting data sets from the yahooSeries function,
> see below.  I 
> return a data frame successfully, however how do i access
> the date 
> field.  When viewing the structure i don't see the
> field, but using head 
> i do see the date field. 
> 
> Can someone provide me some example plot code to plot the
> data in a time 
> series format, with the dates going across the X axis
> labels? 
> -zubin
> 
> 
> 
> zdata <-     yahooSeries(symbols =
> c("^NDX","UYG"), from =
> '2006-01-01', 
> to = '2008-07-06', quote = c("Open",
> "High", "Low", "Close",      
>   
>      "Volume"), aggregation = c("d"),
> returnClass = c("data.frame"))
> 
> str(zdata)
> 'data.frame':    653 obs. of  10 variables:
>  $ X.NDX.Open  : num  1654 1684 1698 1718 1734 ...
>  $ X.NDX.High  : num  1687 1697 1708 1736 1745 ...
>  $ X.NDX.Low   : num  1634 1682 1697 1711 1730 ...
>  $ X.NDX.Close : num  1680 1696 1705 1735 1742 ...
>  $ X.NDX.Volume: num  2.00e+09 1.88e+09 1.89e+09 2.23e+09
> 1.95e+09 ...
>  $ UYG.Open    : num  NA NA NA NA NA NA NA NA NA NA ...
>  $ UYG.High    : num  NA NA NA NA NA NA NA NA NA NA ...
>  $ UYG.Low     : num  NA NA NA NA NA NA NA NA NA NA ...
>  $ UYG.Close   : num  NA NA NA NA NA NA NA NA NA NA ...
>  $ UYG.Volume  : num  NA NA NA NA NA NA NA NA NA NA ...
> 
> head(zdata)
>            X.NDX.Open X.NDX.High X.NDX.Low
> 2006-01-03    1654.39    1686.59   1633.62
> 2006-01-04    1684.05    1696.83   1681.85
> 2006-01-05    1697.80    1707.71   1697.33
> 2006-01-06    1718.17    1735.50   1710.86
> 2006-01-09    1734.50    1745.12   1729.60
> 2006-01-10    1732.25    1744.47   1730.25
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.



More information about the R-SIG-Finance mailing list