[R] lappy and xts get all indexes from a list ?

ce zadig_1 at excite.com
Fri Oct 31 17:44:00 CET 2014


Dear all,

I have a list , and I want to get all indexes ( dates ) of xts objects  in one list:

foo<-list(A = xts(seq(2),seq(Sys.Date(),Sys.Date()+2,length.out=2)), B = xts(seq(1),seq(Sys.Date()-2,Sys.Date()-1,length.out=1)) )

> foo
$A
           [,1]
2014-10-31    1
2014-11-02    2

$B
           [,1]
2014-10-29    1

lapply(foo, function(x) index(x))      gives A and B values separately . I want to get one list like :

"2014-10-31" "2014-11-02" "2014-10-29"

Thanks a lot.



More information about the R-help mailing list