🌐 Functions related to the calculation of distance between geographic points and data partitioning in sliding windows.

knitr::opts_chunk$set(
  comment = "#>",
  out.width = "100%",
  warning = FALSE,
  message = FALSE
)

Libraries 📚

 library(modeltime)
 library(rsample)
 library(parsnip)
 library(recipes)
 library(workflows)
 library(dplyr)
 library(tidyr)
 library(sknifedatar)

Function sliding_window 🔁

This feature allows you to apply a monthly moving sliding window transformation on a data set. The number of folds and the types of variables to be calculated are defined. For a detailed explanation and use case of this function with R code, see Crime occurrence prediction / sliding_window.

pliegues = 1:13
names(pliegues) = pliegues

variables = c("delitos", "temperatura", "mm_agua", "lluvia", "viento")
names(variables) = variables

data_longer_crime %>% head()
sliding_window(data = data_longer_crime %>% dplyr::select(-c(long,lat)),
               inicio = 13,
               pliegues = pliegues,
               variables = variables)

To consult projects where this functions was used, visit:



rafzamb/sknifedatar documentation built on July 22, 2021, 4:10 p.m.