I would say the easiest way to do what you want is to use the foreach
package. It provides a .combine
argument that makes joining together the results from each cycle super easy.
# Create a reproducible example of urls
urls <- rep_len (letters, 614)
# Install and load `foreach`
install.packages ("foreach")
library (foreach)
# Create the loop and indicate that you want to join the results by row
a <- foreach (i=1:614, .combine = rbind) %do% {
as.data.frame (paste(urls[i], 0:10))
}
That's it. You can combine the results in many kinds of classes (vectors, data frames, lists, etc) and ways (by row, by column, etc). Learning to use foreach
won't only be beneficial for this problem, but it will be also very useful, if later you need to do some kind of parallel computation.
If you want to stick to a traditional loop, one of the many ways to do it is:
a <- data.frame ()
for (i in 1:614){
a <- rbind (a, as.data.frame (paste(urls[i], 0:10)))
}
Happy coding!