These functions take the idea of seq_along() and generalise
it to creating lists (list_along) and repeating values
(rep_along).
list_along(x)
| x | A vector. |
|---|---|
| y | Values to repeat. |
A vector of the same length as x.
#> [1] 1 2 1 2 1#> [1] 1 1 1 1 1list_along(x)#> [[1]] #> NULL #> #> [[2]] #> NULL #> #> [[3]] #> NULL #> #> [[4]] #> NULL #> #> [[5]] #> NULL #>