fv_runs {numform}R Documentation

Remove Subsequent Runs from a Vector

Description

Remove subsequent runs from a vector.

Usage

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

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)

[Package numform version 0.7.0 Index]