Function that identifies when a new repetition of values in a vector starts.

start_of_new(x)

Arguments

x

A vector.

Value

A logical vector equal to TRUE

for each instance in which a subsequent value differs from a prior value.

Examples

x <- rep( 1:4, each = 3 )
start_of_new( x )
#>  [1] FALSE FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE FALSE