seq2: Increasing sequence of integers in an interval

View source: R/utils.R

seq2R Documentation

Increasing sequence of integers in an interval

Description

These helpers take two endpoints and return the sequence of all integers within that interval. For seq2_along(), the upper endpoint is taken from the length of a vector. Unlike base::seq(), they return an empty vector if the starting point is a larger integer than the end point.

Usage

seq2(from, to)

seq2_along(from, x)

Arguments

from

integer, the starting point of the sequence.

to

integer, the end point.

x

A vector whose length is the end point.

Value

Returns an integer vector containing a strictly increasing sequence.

Examples

seq2(2, 10)
seq2(10, 2)
seq(10, 2)

seq2_along(10, letters)

csdaw/stringrb documentation built on Aug. 13, 2022, 10:55 p.m.