future_slide() {tsibble}R Documentation

Sliding window in parallel

Description

Multiprocessing equivalents of slide(), tile(), stretch() prefixed by future_.

Details

It requires the package furrr to be installed. Please refer to furrr for performance and detailed usage.

Examples

if (!requireNamespace("furrr", quietly = TRUE)) {
  stop("Please install the furrr package to run these following examples.")
}
## Not run: 
library(furrr)
plan(multiprocess)
my_diag <- function(...) {
  data <- list(...)
  fit <- lm(Count ~ Time, data = data)
  tibble(fitted = fitted(fit), resid = residuals(fit))
}
pedestrian %>%
  group_by_key() %>%
  nest() %>%
  mutate(diag = future_map(data, ~ future_pslide_dfr(., my_diag, .size = 48)))

## End(Not run)

[Package tsibble version 0.8.2 Index]