na_rle_cut: Cut and aggregate run length encoding <'NA'>

Description Usage Arguments Value See Also Examples

View source: R/funs-na-rle.R

Description

Cut and aggregate run length encoding <NA>

Usage

1

Arguments

x

An object returned by na_rle() or list_of_na_rle().

by

A function applied to indices, such as tsibble's period functions and lubridate's friends.

Value

A tibble contains:

See Also

Other rectangling functions: na_rle_expand

Examples

 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)

earowang/mists documentation built on Sept. 21, 2019, 1:12 p.m.