Skip to content
Prev 180042 / 398506 Next

Read many .csv files into an R session automatically, without specifying filenames

Romain Francois wrote:
or maybe

    csvs = Map(read.csv, dir(pattern='\\.csv$'))

possibly with a correction of list item names

    names(csvs) = sub('\\.csv$', '', names(csvs))

which is optional, since the content of foo.csv can be accessed as
csvs$foo (or as csvs[['foo', exact=FALSE]]) instead of csvs$foo.cvs even
without such a correction.

vQ