Skip to contents

Door lookback window pooling for a single block

Usage

door_lookback_block(
  block,
  lookback_size = 20L,
  aggregate_mean = FALSE,
  weighting_linear = FALSE,
  segment_ids = integer()
)

Arguments

block

Numeric matrix of connection counts

lookback_size

Window lookback size

aggregate_mean

Logical: TRUE = mean, FALSE = sum

weighting_linear

Logical: TRUE = linear weights, FALSE = equal

segment_ids

Integer vector of segment IDs (0-indexed or 1-indexed)

Examples

block <- matrix(c(1, 0,
                  2, 1,
                  3, 0,
                  4, 2), nrow = 4, byrow = TRUE)
door_lookback_block(block, lookback_size = 2L)                        # sums
#>      [,1] [,2]
#> [1,]    1    0
#> [2,]    3    1
#> [3,]    5    1
#> [4,]    7    2
door_lookback_block(block, lookback_size = 2L, aggregate_mean = TRUE) # means
#>      [,1] [,2]
#> [1,]  1.0  0.0
#> [2,]  1.5  0.5
#> [3,]  2.5  0.5
#> [4,]  3.5  1.0