Is there a way to apply rollapply() backwards say from 100 to 1 instead of 1 to 100 or should I sort my data first and then apply rollaplly()?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Try this
z = 1:100
#Normal rollapply
rollapply(z, 2, mean)
#Reverese
rollapply(z[length(z):1], 2, mean)