Skip to contents

Constructs iterators that generate regular sequences that follow the seq family.

Usage

iseq(
  from = 1,
  to = NULL,
  by = NULL,
  length_out = NULL,
  along_with = NULL,
  ...,
  recycle = FALSE,
  chunkSize,
  chunks
)

iseq_along(along_with, ...)

Arguments

from

the starting value of the sequence.

to

the end value of the sequence.

by

increment of the sequence.

length_out

desired length of the sequence. A non-negative number, which for seq will be rounded up if fractional.

along_with

the length of the sequence will match the length of this

...

Unused.

recycle

Whether to restart the sequence after it reaches to.

chunkSize

Optional; return this many values per call.

chunks

Optional; return this many chunks.

Value

an iteror.

Details

The iseq function generates a sequence of values beginning with from and ending with to. The sequence of values between are determined by the by, length_out, and along_with arguments. The by argument determines the step size of the sequence, whereas length_out and along_with determine the length of the sequence. If by is not given, then it is determined by either length_out or along_with. By default, neither are given, in which case by is set to 1 or -1, depending on whether to > from.

See also

icount icountn

Examples

it <- iseq(from=2, to=5)
unlist(as.list(it)) == 2:5
#> [1] TRUE TRUE TRUE TRUE