I have many dataframes (week1
, ..., week20
) and I want to call them in a loop:
for (i in 1:20) {
function(weeki)
}
Intuitively, I want to do something like this:
weeki <- paste ("week", i, sep="")
where weeki
refers to the dataframe.
I can make a list :
week <- list (week1, week2, ..., week20)
for (i in 1:20) {
function(week[[i]])
}
But it doesn't help because I have to write the names of the dataframe in that list. I want "week" to be a list of all "weeki" dataframes and that week[[i]] = weeki