How can I do the following operation in a for loop?
x <- runif(30, 0, 1)
sub_1 <- x[1:10]
sub_2 <- x[11:20]
sub_3 <- x[21:30]
That is, I want to create three different objects, each one with a subset of the initial vector without writing many lines of code.
This is of course a simple case that I created to make things easier. In my real case I have a big dataset that I want to subset in a similar fashion and assign names. I ask for a for loop because I struggle understanding the logic behind for loops and I rarely succeed at make them work. So extra explanations are welcome.