View source: R/slide-period2.R
slide_period2 | R Documentation |
slide_period2()
and pslide_period()
represent the combination
of slide2()
and pslide()
with slide_period()
, allowing you to slide
over multiple vectors at once, using indices defined by breaking up the
.i
-ndex by .period
.
slide_period2(
.x,
.y,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE
)
slide_period2_vec(
.x,
.y,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE,
.ptype = NULL
)
slide_period2_dbl(
.x,
.y,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE
)
slide_period2_int(
.x,
.y,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE
)
slide_period2_lgl(
.x,
.y,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE
)
slide_period2_chr(
.x,
.y,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE
)
slide_period2_dfr(
.x,
.y,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE,
.names_to = rlang::zap(),
.name_repair = c("unique", "universal", "check_unique")
)
slide_period2_dfc(
.x,
.y,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE,
.size = NULL,
.name_repair = c("unique", "universal", "check_unique", "minimal")
)
pslide_period(
.l,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE
)
pslide_period_vec(
.l,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE,
.ptype = NULL
)
pslide_period_dbl(
.l,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE
)
pslide_period_int(
.l,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE
)
pslide_period_lgl(
.l,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE
)
pslide_period_chr(
.l,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE
)
pslide_period_dfr(
.l,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE,
.names_to = rlang::zap(),
.name_repair = c("unique", "universal", "check_unique")
)
pslide_period_dfc(
.l,
.i,
.period,
.f,
...,
.every = 1L,
.origin = NULL,
.before = 0L,
.after = 0L,
.complete = FALSE,
.size = NULL,
.name_repair = c("unique", "universal", "check_unique", "minimal")
)
.x , .y |
Vectors to iterate over. Vectors of size 1 will be recycled. |
.i |
A datetime index to break into periods. There are 3 restrictions on the index:
|
.period |
A string defining the period to group by. Valid inputs can be roughly broken into:
|
.f |
If a function, it is used as is. If a formula, e.g.
This syntax allows you to create very compact anonymous functions. |
... |
Additional arguments passed on to the mapped function. |
.every |
The number of periods to group together. For example, if the period was set to |
.origin |
The reference date time value. The default when left as This is generally used to define the anchor time to count from, which is
relevant when the every value is |
.before , .after |
The number of values before or after the current element to
include in the sliding window. Set to |
.complete |
Should the function be evaluated on complete windows only? If |
.ptype |
A prototype corresponding to the type of the output. If If supplied, the result of each call to If |
.names_to |
This controls what to do with input names supplied in
|
.name_repair |
One of With |
.size |
If, Alternatively, specify the desired number of rows, and any inputs of length 1 will be recycled appropriately. |
.l |
A list of vectors. The length of |
A vector fulfilling the following invariants:
slide_period2()
vec_size(slide_period2(.x, .y)) == vec_size(unique(warp::warp_distance(.i)))
vec_ptype(slide_period2(.x, .y)) == list()
slide_period2_vec()
and slide_period2_*()
variantsvec_size(slide_period2_vec(.x, .y)) == vec_size(unique(warp::warp_distance(.i)))
vec_size(slide_period2_vec(.x, .y)[[1]]) == 1L
vec_ptype(slide_period2_vec(.x, .y, .ptype = ptype)) == ptype
pslide_period()
vec_size(pslide_period(.l)) == vec_size(unique(warp::warp_distance(.i)))
vec_ptype(pslide_period(.l)) == list()
pslide_period_vec()
and pslide_period_*()
variantsvec_size(pslide_period_vec(.l)) == vec_size(unique(warp::warp_distance(.i)))
vec_size(pslide_period_vec(.l)[[1]]) == 1L
vec_ptype(pslide_period_vec(.l, .ptype = ptype)) == ptype
slide2()
, slide_index2()
, slide_period()
i <- as.Date("2019-01-28") + 0:5
slide_period2(
.x = 1:6,
.y = i,
.i = i,
.period = "month",
.f = ~data.frame(x = .x, i = .y)
)
pslide_period(
.l = list(1:6, 7:12, i),
.i = i,
.period = "month",
.f = ~data.frame(x = .x, y = .y, i = ..3)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.