matlabColon {SSBtools} | R Documentation |
Simulate Matlab's ':'
Description
Functions to generate increasing sequences
Usage
matlabColon(from, to)
SeqInc(from, to)
Arguments
from |
numeric. The start value |
to |
numeric. The end value. |
Details
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.
Value
A numeric vector, possibly empty.
Author(s)
Bjørn-Helge Mevik (matlabColon) and Øyvind Langsrud (SeqInc)
See Also
Examples
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)
[Package SSBtools version 1.5.2 Index]