Hello, I am using rollapply() from package zoo to use a function on unique windows from a dataset. Because my dataset is not a multiple of my window width, it matters which end I start at. Here is a simple example, the result I want is 7.5 (i.e., start at the highest level of my ordering variable). I thought that the argument ascending = FALSE would do it, but it does not seem to have an effect. It seems like I must be missing something simple.
#Library and sample data library(zoo) mydata <- zoo(x = 6:8, order.by = 1:3) rollapply(data = mydata, width = 2, by = 2, FUN = mean, ascending = TRUE, align = "left") #This gives the same results rollapply(data = mydata, width = 2, by = 2, FUN = mean, ascending = FALSE, align = "left") Thanks, Josh -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/ ______________________________________________ R-help@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.