Skip to contents

Creates a vector containing a sequence of values starting at the beginning and going to the end.

Usage

seq_along_cpp(along_with)

Arguments

along_with

A vec with length \(n\).

Value

A vector of length \(n\) that contains integer values in \([0, n - 1]\).

See also

Author

James J Balamuta

Examples

# Call with the following data:
seq_along_cpp(1:10)
#>       [,1]
#>  [1,]    0
#>  [2,]    1
#>  [3,]    2
#>  [4,]    3
#>  [5,]    4
#>  [6,]    5
#>  [7,]    6
#>  [8,]    7
#>  [9,]    8
#> [10,]    9
seq_along_cpp(5:10)
#>      [,1]
#> [1,]    0
#> [2,]    1
#> [3,]    2
#> [4,]    3
#> [5,]    4
#> [6,]    5