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))
Ehsan
July 12, 2024, 2:58pm
22
dromano:
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:
Bind any number of data frames by row, making a longer result. This is
similar to do.call(rbind, dfs), but the output will contain all columns
that appear in any of the inputs.
system
Closed
July 19, 2024, 3:09pm
24
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.