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

Immanuel mane.desk at googlemail.com
Tue Nov 2 21:57:28 CET 2010


great, thanks
On 11/02/2010 09:30 PM, Joshua Ulrich wrote:
> 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