Re: [R] Import Multiple csv files and merge into one Master file

2010-10-08 Thread Dennis Murphy
Hi: An alternative approach with a few less keystrokes, using the plyr package: library(plyr) # Create some example data files, populate them and write them out using write.csv: fnames <- c(paste('file0', 1:9, '.csv', sep = '')) for(i in seq_along(fnames)) { d <- data.frame(x = rnorm(3), y

Re: [R] Import Multiple csv files and merge into one Master file

2010-10-08 Thread Joshua Wiley
Hi Xinli, You will probable have to tweak this some for it to work for you, but it at least gives you an idea. First put all your files in one directory, then you use the list.files() function to read into R the names of every file in that directory (this is easier than typing all 100 something n

Re: [R] Import Multiple csv files and merge into one Master file

2010-10-07 Thread Joshua Wiley
Hi Xing, This depends somewhat on what you mean by "merge", and how many files you are talking about. Supposing you are dealing with few enough files you can do it manually: dat1 <- read.csv("yourfile1.csv") dat2 <- read.csv("yourfile2.csv") ... datn <- read.csv("yourfilen.csv") If each file co

Re: [R] Import Multiple csv files and merge into one Master file

2010-10-07 Thread Erik Iverson
See the R Data Import/Export manual for the first step: http://cran.r-project.org/doc/manuals/R-data.html ?read.table should help you out. You might use ?lapply along with read.table to read in multiple files. Then, use ?merge, possibly in tandem with the ?Reduce function, depending on how man

[R] Import Multiple csv files and merge into one Master file

2010-10-07 Thread XINLI LI
Dear R Group: How to import multiple csv files and merge into one dataset. Thanks and Regards, Xing [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read t