
Last chance! 50% off unlimited learning
Sale ends in
Tiling window without overlapping observations:
tile()
always returns a vector of numerics
tile_lst()
returns a list
tile_dfr()
return data frame using row-binding
tiler()
splits the input x
to a list according to the window size.
tile(x, .f, ..., size = 1)tile_lst(x, .f, ..., size = 1)
tile_dfr(x, .f, ..., size = 1, .id = NULL)
tiler(x, size = 1)
A vector of numerics, or data frame. If a data frame, row-wise rolling window is performed.
A function or one-sided formula using purrr-like syntax. If a formula, it is converted to a function.
Additional arguments passed on to .f
.
An integer for window size.
If not NULL
a variable with this name will be created giving
either the name or the index of the data frame, which is passed to
dplyr::bind_rows.
slide for sliding window with overlapping observations; stretch for expanding more observations
# NOT RUN {
# tiling over a vector ----
x <- 1:10
tile(x, sum, size = 3)
tile(x, ~ sum(.), size = 3)
tiler(x, size = 3)
# tiling over a 2-day window for hourly data ----
# }
# NOT RUN {
pedestrian %>%
split_by(Sensor) %>%
purrr::map_dfr(~ tile_dfr(., ~ quantile(.$Count), size = 48))
# }
Run the code above in your browser using DataLab