# Import files under folder name fawn # It is very important to include the option (full.names=TRUE). It it is not included # then you will get the error something like # "Error in file(file, "rt") : cannot open the connection In addition: Warning message: #In file(file, "rt") : cannot open file 'FAWN_2002.csv': No such file or directory mydata=ldply(list.files(path="data/fawn/",pattern="csv",full.names=TRUE),function(filename) { dum=read.csv(filename) dum$filename=filename return(dum) }) # If you are already in the root folder and you want to read csv files, you can simply do: mydata=ldply(list.files(pattern="csv"),function(filename) { dum=read.csv(filename) dum$filename=filename return(dum) })