[R] Confusion in 'quantile' and getting rolling estimation of sample quantiles

Saji Ren saji.ren at gmail.com
Mon Jan 18 07:10:53 CET 2010


Gabor, 
about problem 1. , now I understand.
But in problem 2. , I do as your recommandation. and it still doesn't work.
I wonder is there any detail introduction about the form of the 'FUN' in the
'rollapply'?
Can you help me again?

Thank you very much!

Best regard
Saji


There is no quantile method defined for zoo objects so it falls
through to the default method but that method does not work for zoo
objects.  Try this:

set.seed(123)
rn <- rnorm(500)
quantile(rn, 0.8)
quantile(coredata(zoo(rn)), 0.8)

In the second question the error message tells you what the problem
is.  FUN is supposed to be a function but a vector of numbers has been
supplied rather than a function.  Try:

uprange=rollapply(x,width=10,FUN=function(x)quantile(x,0.8),align='right')



-----
------------------------------------------------------------------
Saji Ren
from Shanghai China
GoldenHeart Investment Group
------------------------------------------------------------------
-- 
View this message in context: http://n4.nabble.com/Confusion-in-quantile-and-getting-rolling-estimation-of-sample-quantiles-tp1015893p1016399.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list