The query is to select elements at indices 1,4,7,10,13...
It could be done in several ways, but I do not understand the working of the following :
yVec <- sample(0:999,size = 250,replace = T)
c(TRUE, FALSE, FALSE) is recycling to the entire vector and will extract the 1st, 4th, 7th, etc values of the
vector. It is similar to replicating the logical vector to the length of the vector.
yVec[rep(c(TRUE, FALSE, FALSE), length.out = length(yVec))]
Wherever the logical vector is TRUE, it will extract the corresponding element in 'yVec'.