[R] Returning highs and lows in R

Peter Ehlers ehlers at ucalgary.ca
Thu Oct 28 18:39:39 CEST 2010


On 2010-10-28 09:27, Jason Kwok wrote:
> I'm having trouble returning a rolling n period highest value for a data
> set.  For each day I want to calculate the highest value over the last 3
> days.  I am using the following packages: zoo, xts, quantmod and TTR.

Isn't that exactly what rollmax() does?

    -Peter Ehlers

>
> Thanks, Jason
>
>             GLD.Close
> 2010-10-01    128.91
> 2010-10-04    128.46
> 2010-10-05    130.99
> 2010-10-06    131.81
> 2010-10-07    130.37
> 2010-10-08    131.66
> 2010-10-11    132.29
> 2010-10-12    131.96
> 2010-10-13    134.07
> 2010-10-14    134.75
> 2010-10-15    133.68
> 2010-10-18    134.28
> 2010-10-19    130.11
> 2010-10-20    131.32
> 2010-10-21    129.47
> 2010-10-22    129.73
> 2010-10-25    130.85
> 2010-10-26    130.88
> 2010-10-27    129.52
>>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list