You can use the list.files() function to get all the file names in a folder and then loop through them using a for loop or lapply() function. Here is an example:
main.r
# set the path to the folderpath <- "/path/to/folder/"# get all the file names in the folderfiles <- list.files(path)
# loop through each file and read it infor (file in files) {
data <- read.csv(paste0(path, file))
# do some processing on the data}
# or use lapply() functiondata_list <- lapply(files, function(file) {
read.csv(paste0(path, file))
})