I have an empty data frame an I want to fill this data frame by adding new columns, but when I run the code it throws the following error:
Error in data.frame(..., check.names = FALSE) :
arguments imply differing number of rows: 0, 102
I know the problem is that my empty data frame does not have a row number. My question is, is there a way to fill an empty dataframe when you don't know how many rows your columns will have? In other words, when there is no row number in the empty data frame.
Currently I am trying:
df <- data.frame()
for (i in 1:(length(hojas)-1)) {
dat <- read_excel(". . .", sheet = sheet_names[i])
df <- cbind(df, dat)
}