I've seen this answer to take a list of numbers and apply a function to each element to make a modified list: https://stackoverflow.com/a/26164349/115237
Given a list like this:
# x <- sample(seq(1, 91, 10))
x <- c(1, 61, 81, 51, 41, 71, 31, 21, 11, 91)
How can I apply a function / use a list-comprehension to take each element and then "add-in" the next 9 numbers, returning this for the above list:
c(1:10, 61:70, 81:90, 51:60, 41:50, 71:80, 31:40, 21:30, 11:20, 91:100)
I'm using this to roll my own sampling to get chunks of ten at a time: the first ten, then 60s, then 80s, ... . I've been trying to use a function like this:
f1 <- function(x) {seq(x,x+10)}
Also, is there a built-in tool for this kind of sampling - where you can also do replacement in the sampling?