I would like to turn this list [1, 2, 3, 4, 5, 6, 7, 8, 9] into the following set of vectors
[1, 2, 3, 4, 5, 6, 7, 8, 9]
(2,3,4) (3,4,5) (4,5,6) (5,6,7) (6,7,8) (7,8,9)
x = c(1, 2, 3, 4, 5, 6, 7, 8, 9) n = length(x) lapply(1:(n - 2), function(i) x[i:(i + 2)])
1.4m articles
1.4m replys
5 comments
57.0k users