Seq {lazy.tools} | R Documentation |
Smart Sequyence Generation
Seq(from, to)
from |
the startingvalue of the sequence |
to |
the ending value of the sequence |
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)) } }
for( i in Seq(3,5) ) print(i)
for( i in Seq(5,3) ) print(i)
for( i in seq(5,3) ) print(i)