fv_runs: Remove Subsequent Runs from a Vector

Description Usage Arguments Value Examples

View source: R/fv_runs.R

Description

Remove subsequent runs from a vector.

Usage

1
fv_runs(x, fill = "", missing = NA, ...)

Arguments

x

A vector with runs.

fill

What to fill in subsequent runs with.

missing

What to fill in missing values with.

...

ignored.

Value

Returns a vector of strings with subsequent runs removed.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
x <- c(1, 1 , 2, 3, 4, 4, 1, 1, 3, 3, NA, 5)
fv_runs(x)
fv_runs(x, fill = '-')
fv_runs(x, fill = '-', missing = 'X')

## Not run: 
library(dplyr)

set.seed(10)
data.frame(
    state = sort(sample(state.name[c(1, 5, 9, 12)], 12, TRUE)),
    val = rnorm(12)
) %>%
    mutate(state2 = fv_runs(state))

## End(Not run)

numform documentation built on Oct. 10, 2021, 1:10 a.m.