As you can see below, a is an empty 'xts' object. Somehow when indexing with dates, it returns the dimname as a string...
> a
Split
> dimnames(a)
[[1]]
NULL
[[2]]
[1] "Split"
> str(a)
An 'xts' object of zero-width
> str(a['2003'])
chr "Split"
Has anyone encountered this already? Does anyone know a workaround? Any help is appreciated.
Here is the actual scenario
library(TTR)
d = getYahooData('ACE', 20121201, 20121231, freq="daily", type="split", adjust=F, quiet=T)
s = d[!is.na(d[, 2]), 2]
> s
Split
> s['2012']
[1] "Split"
> str(s)
An 'xts' object of zero-width
> str(s['2012'])
chr "Split"
and
> sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
[4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
[7] LC_PAPER=C                 LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
  [1] XML_3.95-0.1    tseries_0.10-30 TTR_0.21-1      xts_0.9-1       zoo_1.7-9      
loaded via a namespace (and not attached):
  [1] grid_2.14.1      lattice_0.20-0   quadprog_1.5-4   rstudio_0.97.248 tools_2.14.1    
 
    