Expand and count run length encoding <NA>

na_rle_expand(x)

na_rle_table(x)

Arguments

x

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

See also

Other rectangling functions: na_rle_cut

Examples

(x <- na_rle(c(1, NA, NA, 4:7, NA, NA, 10:15, NA)))
#> <Run Length Encoding <NA>[3]> #> $lengths: <int> 2 2 1 #> $indices: <int> 2 8 16
na_rle_expand(x)
#> # A tibble: 5 x 2 #> lengths indices #> <int> <int> #> 1 2 2 #> 2 2 3 #> 3 2 8 #> 4 2 9 #> 5 1 16
na_rle_table(x)
#> # A tibble: 2 x 3 #> lengths n nobs #> <int> <int> <int> #> 1 1 1 1 #> 2 2 2 4