I am trying to generate the following sequence
0, 1, 2, 3, 10, 11, 12, 13, 20, 21, 22, 23
The input would be starting number 0
, sub-sequence length 4
, sequence-spacing 10
, and number of sub-sequences 3
. The length of the full sequence would be 4 x 3 = 12
.
Below is what I have using purrr
functions. I am still new to map
and your comments or suggestions are welcome.
library(tidyverse)
seq.int(from = 0, by = 10, length.out = 3) %>%
map(function(x)(seq.int(from = x, length.out = 4))) %>%
reduce(c)
#> [1] 0 1 2 3 10 11 12 13 20 21 22 23
Created on 2019-03-13 by the reprex package (v0.2.1)