简体   繁体   中英

Rollapply() backwards in R

有没有办法应用rollapply()向后说从100到1而不是1到100或者我应该先排序我的数据然后应用rollaplly()?

Try this

z = 1:100
#Normal rollapply
rollapply(z, 2, mean)

#Reverese
rollapply(z[length(z):1], 2, mean)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM