Skip to contents

Similar to seq.int, but returns an empty vector (integer(0)) if the starting point is larger than the end point.

Usage

seq2(from, to)

Arguments

from

(Scalar integer)
The beginning value of the integer sequence.

to

(Scalar integer)
The ending value of the integer sequence.

Value

Integer vector

Details

Safer than using something like from:to or seq.int in a programming scenario.

Examples

#----------------------------------------------------------------------------
# seq2() examples
#----------------------------------------------------------------------------
library(bkbase)

seq2(from = 1, to = 5)
#> [1] 1 2 3 4 5
seq2(from = 1, to = 1)
#> [1] 1
seq2(from = 1, to = 0)
#> integer(0)