rep2abI(x, times) conceptually computes rep.int(x, times) but with an abIndex class result.

rep2abI(x, times)

Arguments

x

numeric vector

times

integer (valued) scalar: the number of repetitions

Value

a vector of class abIndex

See also

rep.int(), the base function; abIseq, abIndex.

Examples

(ab <- rep2abI(2:7, 4))
#> Abstract Index vector (class 'abIndex') of length 24, kind "rleDiff"
#>  and slot "rleD":
#>  RLE difference (class 'rleDiff'): first = 2, "rle":
#>    Run Length Encoding
#>      lengths: int [1:7] 5 1 5 1 5 1 5
#>      values : int [1:7] 1 -5 1 -5 1 -5 1
stopifnot(identical(as(ab, "numeric"),
     rep(2:7, 4)))