1

I have an Excel workbook with 10 sheets, each one with the name of a country. The first row of all sheets is the same. What I need is to join them all in a single dataframe in R. I have been using the "readxlsx" library, but I can only read one sheet at a time, and I still don't know how to join them all ...

Any help will be very appreciated.

1 Answer 1

1

Try this. read all the files into a list using for loop and then you can combine all the data frames

data_list <- list()

for(i in 1:10){
data_list[[i]] <- readxlsx('excel_file', sheet = i)
}

combined_dataframe <- do.call(rbind, data_list)
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! It was really helpfull.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.