Say I have a vector with 1000 values and I want to ‘split/partition/group’ this vector into multiple vectors each with 200 values and an overlap of 100 values between them.
E.g.:
vec = seq(1,1000)
splitWithOverlap(vec, 200, 100)
should return the following vectors:
[0:200] [100:300] [200:400] [300:500] ...
… you get the idea.
Is there a function in R with which I can do that?
No, but this will do it: