A “safer” seq

Share:

Description

This is the same as seq(from, to, by) except that when the sign of by is wrong, safeseq returns a zero-length vector rather than throwing an error.

Usage

1
safeseq(from = 1L, to = 1L, by = 1L, ...)

Arguments

from

The same as the from in base::seq.

to

The same as the to in base::seq.

by

The same as the by in base::seq.

...

The same as in base::seq.

Value

A vector of the same class as by*(from-to), but possibly with length being zero.

Author(s)

Long Qu

See Also

base::seq

Examples

1
identical(integer(0L), safeseq(1L, 0L, 1L))

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.