Slide family

The slide(.x, .f) functions are similar to purrr::map(.x, .f). Both iterate over .x, applying .f as they go. The difference is that slide() moves over .x in sliding windows, rather than one element at a time. The return value size is always the same size as .x, and the type is defined by the function suffix.

slide() slide_vec() slide_dbl() slide_int() slide_lgl() slide_chr() slide_dfr() slide_dfc()

Slide

slide2() slide2_vec() slide2_dbl() slide2_int() slide2_lgl() slide2_chr() slide2_dfr() slide2_dfc() pslide() pslide_vec() pslide_dbl() pslide_int() pslide_lgl() pslide_chr() pslide_dfr() pslide_dfc()

Slide over multiple inputs simultaneously

slide_sum() slide_prod() slide_mean() slide_min() slide_max() slide_all() slide_any()

Specialized sliding functions

Slide index family

These functions iterate over .x using sliding windows defined with a secondary index vector, .i. The windows are constructed by “looking back” and “looking forward” a certain number of periods from each element of .i. This is useful for constructing irregular sliding windows, such as sliding with a look back period of two months when you have daily data. In that example, not all months have the same number of days, and some months might be missing data, so a fixed window size wouldn’t be useful.

slide_index() slide_index_vec() slide_index_dbl() slide_index_int() slide_index_lgl() slide_index_chr() slide_index_dfr() slide_index_dfc()

Slide relative to an index

slide_index2() slide_index2_vec() slide_index2_dbl() slide_index2_int() slide_index2_lgl() slide_index2_chr() slide_index2_dfr() slide_index2_dfc() pslide_index() pslide_index_vec() pslide_index_dbl() pslide_index_int() pslide_index_lgl() pslide_index_chr() pslide_index_dfr() pslide_index_dfc()

Slide along multiples inputs simultaneously relative to an index

slide_index_sum() slide_index_prod() slide_index_mean() slide_index_min() slide_index_max() slide_index_all() slide_index_any()

Specialized sliding functions relative to an index

Slide period family

These functions work by iterating over .x in “period blocks”, such as one month blocks of data. The blocks are defined using a combination of a secondary date-like index vector, .i, and a period to block by.

slide_period() slide_period_vec() slide_period_dbl() slide_period_int() slide_period_lgl() slide_period_chr() slide_period_dfr() slide_period_dfc()

Slide relative to an index chunked by period

slide_period2() slide_period2_vec() slide_period2_dbl() slide_period2_int() slide_period2_lgl() slide_period2_chr() slide_period2_dfr() slide_period2_dfc() pslide_period() pslide_period_vec() pslide_period_dbl() pslide_period_int() pslide_period_lgl() pslide_period_chr() pslide_period_dfr() pslide_period_dfc()

Slide along multiple inputs simultaneously relative to an index chunked by period

Hop family

These functions are lower level versions of their slide() equivalents. They allow you to manually construct the boundaries to slide with, and are useful if you need more flexibility than what slide() provides.

hop() hop_vec()

Hop

hop2() hop2_vec() phop() phop_vec()

Hop along multiple inputs simultaneously

hop_index() hop_index_vec()

Hop relative to an index

hop_index2() hop_index2_vec() phop_index() phop_index_vec()

Hop along multiple inputs simultaneously relative to an index

Block

block() breaks .x into its “period blocks”. The blocks are defined using a combination of a secondary date-like index vector, .i, and a period to block by. The return value is always a list, and the elements of the list are slices of .x.

block()

Break a vector into blocks