Read all files in a folder and apply a function to each data frame

On the contrary, I do think working with list makes it easy to automate such things. Here is one solution (I stored your four dataframes in folder temp/). filenames <- list.files(“temp”, pattern=”*.csv”, full.names=TRUE) ldf <- lapply(filenames, read.csv) res <- lapply(ldf, summary) names(res) <- substr(filenames, 6, 30) It is important to store the full path for … Read more