R/SlidingWindow.R

Defines functions SlidingWindow

Documented in SlidingWindow

SlidingWindow <- function(FUN, data, window, step){
  total <- length(data)
  spots <- seq(from = 1, to = (total - window), by = step)
  result <- vector(length = length(spots))
  for(i in 1:length(spots)){
    result[i] <- match.fun(FUN)(data[spots[i]:(spots[i] + window - 1)])
  }
  return(result)
}

Try the evobiR package in your browser

Any scripts or data that you put into this service are public.

evobiR documentation built on May 2, 2019, 5:40 a.m.