Read data from several files using tidyplate

Start by loading tidyplate:

library(tidyplate)

Import multiple csv files into separate tibbles:

file <- system.file("extdata", 
                    "example_12_well.xlsx", 
                    package = "tidyplate")
csv_files <- list.files(path = file, 
                        pattern = "*.csv",
                        full.names = TRUE)

names <- tools::file_path_sans_ext(basename(csv_files))

# Loop through the filenames and assign data
for(i in seq_along(csv_files)) {
  assign(names[i], tidy_plate(csv_files[i]))
}

Import multiple csv files as a list of tibbles:

# Initialize an empty list to store tibbles for each file
tb_csv_list <- list()

# Loop through the filenames and assign data
for(i in seq_along(csv_files)) {
  tb_csv_list[[i]] <- tidy_plate(csv_files[i])
}

For multiple excel sheets in the same excel file:

# as individual tibbles
xl_file <- system.file("extdata", 
                       "multisheet_example.xlsx", 
                       package = "tidyplate")

sheets <- readxl::excel_sheets(xl_file)

for (sheet in sheets) {
  tb <- tidy_plate(xl_file, sheet = sheet)
  name <- paste0("tb_", sheet)
  assign(name, tb)
}
#> Plate type: 6-well
#> Plate type: 12-well
#> Plate type: 12-well

# as elements of a list
# Initialize an empty list to store tibbles for each sheet
tb_xl_list <- list()

for (sheet in sheets) {
  tb_xl_list[[sheet]] <- tidy_plate(xl_file, sheet = sheet)
}
#> Plate type: 6-well
#> Plate type: 12-well
#> Plate type: 12-well