Learn R Programming

bit (version 4.5.0.1)

repfromto: Virtual recycling

Description

repfromto virtually recylcles object x and cuts out positions from .. to

Usage

repfromto(x, from, to)

repfromto(x, from, to) <- value

Value

a vector of length from - to + 1

Arguments

x

an object from which to recycle

from

first position to return

to

last position to return

value

value to assign

Author

Jens Oehlschlägel

Details

repfromto is a generalization of rep, where rep(x, n) == repfromto(x, 1, n). You can see this as an R-side (vector) solution of the mod_iterate macro in arithmetic.c

See Also

rep, ffvecapply

Examples

Run this code

  message("a simple example")
  repfromto(0:9, 11, 20)

Run the code above in your browser using DataLab