Description Usage Arguments Value See Also Examples
Cut and aggregate run length encoding <NA
>
1 | na_rle_cut(x, by)
|
x |
An object returned by |
by |
A function applied to |
A tibble contains:
indices
: aggregated indices.
n_run
: the number of unique runs for each by
.
n_na
: the total number of NA
s for each by
.
Other rectangling functions: na_rle_expand
1 2 3 4 5 6 7 8 9 10 11 12 | if (!requireNamespace("nycflights13", quietly = TRUE)) {
stop("Please install the nycflights13 package to run these following examples.")
}
if (!requireNamespace("tidyr", quietly = TRUE)) {
stop("Please install the tidyr package to run these following examples.")
}
library(dplyr, warn.conflicts = FALSE)
nycflights13::weather %>%
group_by(origin) %>%
summarise(wind_gust_na = list_of_na_rle(wind_gust, time_hour)) %>%
mutate(wind_gust_na = na_rle_cut(wind_gust_na, by = tsibble::yearmonth)) %>%
tidyr::unnest(cols = wind_gust_na)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.