tests/testthat/test-weights.R

context("Weights")

test_that("roll_* do not mutate weights vector", {
  d <- data.frame(w = c(0.2, 0.1, 0.1, 0.05, 0.05))
  roll_sum(1:25, n = length(d$w), weights = d$w)
  expect_identical(d$w, c(0.2, 0.1, 0.1, 0.05, 0.05))
})

Try the RcppRoll package in your browser

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

RcppRoll documentation built on May 2, 2019, 3:40 p.m.