-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
59 lines (46 loc) · 1.7 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# tidyroll
<!-- badges: start -->
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
[![Codecov test coverage](https://codecov.io/gh/gacolitti/tidyroll/branch/master/graph/badge.svg)](https://codecov.io/gh/gacolitti/tidyroll?branch=master)
[![R build status](https://github.com/gacolitti/tidyroll/workflows/R-CMD-check/badge.svg)](https://github.com/gacolitti/tidyroll/actions)
<!-- badges: end -->
`tidyroll` makes it easy to work with irregular time slices for modeling and prediciton with `tidymodels`.
The main function `rolling_origin_nested()` is a wrapper around `rsample::rolling_origin` and facilitates
rolling over different time units instead of a fixed window. The motivation for this function comes
from this [vignette](https://tidymodels.github.io/rsample/articles/Applications/Time_Series.html).
## Installation
```{r, eval = FALSE}
# install.packages("devtools")
devtools::install_github("gacolitti/tidyroll")
```
## Example
```{r example}
suppressPackageStartupMessages(library(tidyroll))
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(rsample))
data("airquality2")
roll <- rolling_origin_nested(
data = airquality2,
time_var = "date",
unit = "month",
start = "2017-08-01",
end = "2017-11-01",
assess = 1
)
roll
analysis(roll$splits[[1]])
assessment(roll$splits[[1]])
analysis(roll$splits[[1]])$data %>% last() %>% tail()
assessment(roll$splits[[1]])$data %>% first() %>% head()
```