I would like to loop through data frames in R (each with the same name stub and a different identifying number/index at the end of the name) to create new dataframes with different name stubs and the same identifying number as the data frame it was created from.
Here is a link to the data: https://drive.google.com/drive/folders/14cGmcjGkYfr5X-ZE08uA71-X_wQiw_TY?usp=sharing
Below is the code for I would like, where [i] would be replaced by the consecutive ID number 1 through 204. Is there an elegant way to do this?
for (i in 1:204) {
ref[i] <- read.dta("F:/ref[i]pde.dta")
distref[i] <-osrmTable(loc=ref[i][1:length(ref[i]), c("pde","lon","lat")])
trips[i] <-osrmTable(loc=ref[i])
}