matlabColon | R Documentation |
Functions to generate increasing sequences
matlabColon(from, to)
SeqInc(from, to)
from |
numeric. The start value |
to |
numeric. The end value. |
matlabColon(a,b) returns a:b (R's version) unless a > b, in which case it returns integer(0). SeqInc(a,b) is similar, but results in error when the calculated length of the sequence (1+to-from) is negative.
A numeric vector, possibly empty.
Bjørn-Helge Mevik (matlabColon) and Øyvind Langsrud (SeqInc)
seq
identical(3:5, matlabColon(3, 5)) ## => TRUE
3:1 ## => 3 2 1
matlabColon(3, 1) ## => integer(0)
try(SeqInc(3, 1)) ## => Error
SeqInc(3, 2) ## => integer(0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.