Try this:
filenames <- sprintf("data%d.csv", 1:20)
DFs <- sapply(filenames, read.csv, simplify = FALSE)
which will return a list of data frames, DFs, each named by its
filename so that DFs[[1]] or DFs[["data1.csv"]] give the data frame
read from data1.csv, etc. and names(DFs) gives a vector of th
input <- lapply(1:20, function(.file) read.csv(paste('data', .file,
'.csv', sep='')))
This will create a list of 20 with the dataframe from each file in the list.
On Sat, Sep 26, 2009 at 11:47 PM, legen wrote:
>
> Hello, all:
>
> I have twenty datasets named as: data1.csv, data2.csv, …, data20.c
2 matches
Mail list logo