Seq {lazy.tools}R Documentation

Smart Sequyence Generation

Description

Smart Sequyence Generation

Usage

Seq(from, to)

Arguments

from

the startingvalue of the sequence

to

the ending value of the sequence

Details

This function is defined as

  from-1 + seq_len(max(0,to-from+1))

so that when from > to Seq( from, to ) returns numeric(0).

Basically, same as

Seq <- function(from, to) {
  if (from <= to) {
     return(from:to)
  } else {
     return(numeric(0))
  }
}

Examples

for( i in Seq(3,5) ) print(i)
for( i in Seq(5,3) ) print(i)
for( i in seq(5,3) ) print(i)


[Package lazy.tools version 0.1.4 ]