search for: neighborapply

Displaying 2 results from an estimated 2 matches for "neighborapply".

2009 Aug 30
2
aggregating irregular time series
Hi, I have a couple of aggregation operations that I don't know how to accomplish. Let me give an example. I have the following irregular time series time x 10:00:00.021 20 10:00:00.224 20 10:00:01.002 19 10:00:02:948 20 1) For each entry time, I'd like to get sum of x for the next 2 seconds
2009 Sep 01
1
Logistic Politomic Regression in R
...Aggregating irregular time series To: R_help Help <rhelpacc@gmail.com> Cc: r-sig-finance@stat.math.ethz.ch, r-help@r-project.org Message-ID:     <971536df0908302008p379ee9b3v887a959c400a2d1f@mail.gmail..com> Content-Type: text/plain; charset=ISO-8859-1 Try this for the first question: neighborapply <- function(z, width, FUN) {     out <- z     ix <- seq_along(z)     jx <- findInterval(time(z) + width, time(z))     out[] <- mapply(function(i, j) FUN(c(0, z[seq(i+1, length = j-i)])), ix, jx)     out } # test - corrected :948 in last line library(zoo) library(chron) Lines <-...