Loop over data frames

What happens if you replace this:

azryr <- assign( paste0("azr", i), read_excel("data/fdz.xlsx", sheet = paste0(i),  range = "A4:H187")) 
assign("azr", cbind(get("azr"), year = i))

by this?

assign("azr", read_excel("data/fdz.xlsx", sheet = paste0(i),  range = "A4:H187")) 
assign(paste0("azr", i), cbind(get("azr"), year = i))

Great, that works fine and gives for each data sets a new column "year" for the respective year.
How can I now combine/append all these datafiles azr2015-azr2022 to one data set?

There are many ways, including bind_rows from dplyr:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.