Learn R Programming

varComp (version 0.2-0)

safeseq: A ``safer'' seq

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

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.

See Also

base::seq

Examples

Run this code
# NOT RUN {
identical(integer(0L), safeseq(1L, 0L, 1L))

# }

Run the code above in your browser using DataLab