Learn R Programming

SSBtools (version 0.2)

matlabColon: Simulate Matlab's ':'

Description

A function to simulate Matlab's ':' operator

Usage

matlabColon(from, to)

Arguments

from
numeric. The start value
to
numeric. The end value.

Value

A numeric vector, possibly empty.

Details

matlabColon(a,b) returns a:b (R's version) unless a > b, in which case it returns numeric(0).

See Also

seq

Examples

Run this code
identical(3:5, matlabColon(3, 5)) ## => TRUE
3:1 ## => 3 2 1
matlabColon(3, 1) ## => numeric(0)

Run the code above in your browser using DataLab