On Sun, Mar 25, 2012 at 3:15 AM, Worik R <wor...@gmail.com> wrote: > Friends > > I have an xts that I wish to access. > > Browse[2]> DATA.ba[[p]]["2012-03-20 00:59:57","bid"] > bid > 2012-03-20 00:59:57 1.4993 > > So far so good. > > Now putting the index into a variable: > > Browse[2]> Time > [1] "2012-03-20 00:59:57 NZDT" > Browse[2]> DATA.ba[[p]][Time, "bid"] > bid > > Where has it gone? > It's hard to say, especially since you give no indication how you assigned the value to Time. A reproducible example, as requested in the posting guide, would be helpful. Also, what version of R, xts, and zoo are you using?
> > Looking closer.... > > > Browse[2]> index(DATA.ba[[p]]["2012-03-20 00:59:57","bid"]) > [1] "2012-03-20 00:59:57 NZDT" > Browse[2]> > > Browse[2]> Time > [1] "2012-03-20 00:59:57 NZDT" > Browse[2]> > > Browse[2]> index(DATA.ba[[p]]["2012-03-20 00:59:57","bid"]) == Time > [1] FALSE > Browse[2]> > > Browse[2]> class(Time) > [1] "POSIXct" "POSIXt" > > Browse[2]> class(index(DATA.ba[[p]]["2012-03-20 00:59:57","bid"])) > [1] "POSIXct" "POSIXt" > > So the variable 'Time' should be good to index DATA.ba[[p]]. I am > hopelessly confused. > The printed representation of the index value and class cannot be used to accurately determine equality. > cheers > Worik > -- Joshua Ulrich | FOSS Trading: www.fosstrading.com R/Finance 2012: Applied Finance with R www.RinFinance.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.