Learn R Programming

santoku (version 0.10.0)

exactly: Define singleton intervals explicitly

Description

exactly() duplicates its input. It lets you define singleton intervals like this: chop(x, c(1, exactly(2), 3)). This is the same as chop(x, c(1, 2, 2, 3)) but conveys your intent more clearly.

Usage

exactly(x)

Value

The same as rep(x, each = 2).

Arguments

x

A numeric vector.

Examples

Run this code
chop(1:10, c(2, exactly(5), 8))

# same:
chop(1:10, c(2, 5, 5, 8))

Run the code above in your browser using DataLab