[R-SIG-Finance] getting date of highest value (xts)

Joshua Ulrich josh.m.ulrich at gmail.com
Tue Nov 2 21:30:38 CET 2010


Hi Immanuel,

You can use which.max for that.

> Hi(GDAXI)[which.max(Hi(GDAXI))]
           GDAXI.High
2007-07-13    8151.57

Best,
--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com



On Tue, Nov 2, 2010 at 3:26 PM, Immanuel <mane.desk at googlemail.com> wrote:
> Hello all,
>
> I would like to know when the highest price value
> in a given xts time series occurred but I couldn't figure out
> how to do this, can anybody help?
>
> thanks
>
>
> --------------------
> # load libraries
> library(quantmod)
> library(TTR)
>
> getSymbols("^GDAXI")
>
> OHLC.data <- GDAXI["2010-03-01/2010-09-10"]
>
> # I want to know the date where the highest value occurred
>
> max(Hi(GDAXI))
> # returns only the highest value, but I would like to know the date...
>
> _______________________________________________
> 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.
> -- Also note that this is not the r-help list where general R questions should go.
>



More information about the R-SIG-Finance mailing list