Hi guys,
I am relatively new to R. I am not sure about how to merge multiple files with multiple worksheets with different numbers of rows and columns into one table. Is it possible? Do I use full join or rbind? I managed to import the files and worksheets in R but I don't know how to merge all these files in one table
File A -worksheet 1
File B - worksheets 1-74
File C- worksheets 1-9
I used the code below to import the files and worksheets.
library(tidyverse)
library(readxl)
read_excel_allsheets <- function(filename){
sheets <- readxl::excel_sheets(filename)
x <- lapply(sheets, function(x) readxl::read_excel(filename, sheet = x))
names(x) <- sheets
x
}
files <- list.files(path = "Data/Multiple files/", pattern = "*.xlsx", full.names = TRUE)
out <- lapply(files, read_excel_allsheets)
names(out) <- basename(files)
Now how do I merge these files and worksheets together.