Learn R Programming

Rsundials (version 1.6)

gseq: Geometric Sequence Creator

Description

This simple function creates a geometric sequence

Usage

gseq(from, to, by, addrem = FALSE, addzero = FALSE)

Arguments

from
the initial value
to
the final value
by
the multiplication factor
addrem
if the final value is surpassed by multiplication, add.rem = TRUE will add it as the last element of the vector
addzero
add a zero at the beginning

Examples

Run this code
### For thse sequence 0 .4, 4, 40, ..., 4e10
gseq(.4,4e10,10, addzero = TRUE)

### A truncated sequence without add.rem
gseq(1,100,2)

### A truncated sequence with add.rem
gseq(1,100,2,addrem = TRUE)

Run the code above in your browser using DataLab