look_back: Find the average of the transformation of n previous...

Description Usage Arguments Value Examples

View source: R/look_back.r

Description

Find the average of the transformation of n previous elements.

Usage

1
2
look_back(x, length = 1, rule = function(j) {     j },
  decay = function(distance) {     rep(1, length(distance)) })

Arguments

x

input vector

length

number of elements to look back (size of window)

rule

an "adherance" function that transforms each element of the sequence

decay

a function that describes how the importance of an observation should decrease with distance

Value

numeric vector giving the average of the transformation of (length) previous elements

Examples

1
2
look_back(c(1,0,1,1,1,0,1,1,0,1,1))
look_back(c(1,2,3,4,5,6), rule = function(j){j>3}, decay = function(d){1/d})

davefol/streakR documentation built on May 28, 2019, 12:56 p.m.