unfill: Un-fill a vector

Description Usage Arguments Value Examples

View source: R/unfill.R

Description

Replace repeated runs of a value in a vector with a single value.

Usage

1
unfill(x, tokeep = c("first", "last", "middle"), value = NA)

Arguments

x

A vector

tokeep

If "first", then keep the first value. If "last", then keep the last value in the run. If "middle", keep the middle value.

value

The value to use to unfill the vector.

Value

The vector x with the elements other than those specified in tokeep, replaced with value.

Examples

1
2
3
4
unfill(c(rep("a", 3), rep("b", 2)))
unfill(c(rep("a", 3), rep("b", 2)), value = "...")
unfill(c(rep("a", 3), rep("b", 2)), "first")
unfill(c(rep("a", 3), rep("b", 2)), "middle")

jrnold/rubbish documentation built on May 20, 2019, 2:05 a.m.