[R] Re ad in multiple datasets

jim holtman jholtman at gmail.com
Sun Sep 27 06:25:38 CEST 2009


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 <legendy at gmail.com> wrote:
>
> Hello, all:
>
> I have twenty datasets named as: data1.csv, data2.csv, …, data20.csv. I am
> trying to read all of them into R by using loop and function read.table(),
> but I don't know how to handle the name of datasets. Has anybody have
> encountered a similar problem? Or do you have any suggestions? Your help
> would be greatly appreciated.
>
> Legen
>
> --
> View this message in context: http://www.nabble.com/Read-in-multiple-datasets-tp25630688p25630688.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list