R: combine summary of multiple csv files into one data frame
问题 I have a directory with many csv files. I want to read them into then create a summary of a column into one data frame. getSummary<-function(df){ summary(df$Names) } filenames<-list.files(path, pattern="*.csv", full.names=T) ldf<-lapply(filenames, read.csv, header=T) results<-lapply(ldf, getSummary) It is returning results as follows: print(results) [[1]] a b c d 100 2 3 4 [[2]] a b c d 97 4 2 6 What I want is something like this filename a b c d 1.csv 100 2 3 4 2.csv 97 4 2 6 Can someone