fill_gaps: Fill gaps

Description Usage Arguments Details Value Examples

Description

This function fills the gaps in a sequence of booleans.

Usage

1
fill_gaps(x, n = 1)

Arguments

x

A vector of boolean.

n

A scalar integer specifying the length of gaps that we want to fill.

Details

If n = 1, it will replace any TRUE FALSE TRUE sequence by TRUE TRUE TRUE. If n = 1, it will additionally replace any TRUE FALSE FALSE TRUE sequence by TRUE TRUE TRUE TRUE and so on.

Value

A vector of boolean of the same size as x.

Examples

1
2
3
4
x <- rep(c(rep(c(FALSE, TRUE), 7), FALSE),
         c(1, 3, 1, 1, 1, 2, 1, 2, 3, 2, 3, 1, 2, 3, 1))
fill_gaps(x)
fill_gaps(x, 2)

choisy/viparc documentation built on May 30, 2019, 11:38 p.m.