I am a new to R programming. I need to find a way to create a list from a vector but each element should by appended with its following 100 elements; I thought about a for loop but I can't find a way to indicate the "next hundred elements". For example :
input:
a_vec<- c("ant","bee","mosquito","fly")
a_list <- list(("ant"),c("ant","bee"),c("ant","bee","mosquito"),c("ant","bee","mosquito","fly"))
output:
> a_vec
[1] "ant" "bee" "mosquito" "fly"
> a_list
[[1]]
[1] "ant"
[[2]]
[1] "ant" "bee"
[[3]]
[1] "ant" "bee" "mosquito"
[[4]]
[1] "ant" "bee" "mosquito" "fly"
Thanks in advance for your help