first: Identify the First Elements of Series of Repeated Values

Description Usage Arguments Value References Examples

Description

Identify the first elements of series of repeated values.

Usage

1
first(x)

Arguments

x

A vector whose values will be explored for series of repeated values, can be character, numeric, or factor.

Value

An integer vector the same length as x, with a 1 for every element that is different than the one before it, and a 0 for every element that is the same as the one before it.

References

This is a copy of the first function from the [jvamisc] package.

Examples

1
first(c(1, 2, 1, 2, 2, 1, 1, 3))

JVAdams/artiFISHal documentation built on May 7, 2019, 10:14 a.m.