Re: [R] Writing a single output file

2010-12-30 Thread Hadley Wickham
...@gmail.com wrote: From: jim holtman jholt...@gmail.com Subject: Re: [R] Writing a single output file To: Amy Milano milano_...@yahoo.com Cc: r-help@r-project.org Date: Thursday, December 23, 2010, 1:39 PM This should get you close: # get file names setwd('/temp') fileNames - list.files

Re: [R] Writing a single output file

2010-12-29 Thread Amy Milano
apologize for reverting so late. Regards Amy --- On Thu, 12/23/10, jim holtman jholt...@gmail.com wrote: From: jim holtman jholt...@gmail.com Subject: Re: [R] Writing a single output file To: Amy Milano milano_...@yahoo.com Cc: r-help@r-project.org Date: Thursday, December 23, 2010, 1:39 PM

Re: [R] Writing a single output file

2010-12-25 Thread Adaikalavan Ramasamy
Many ways of doing this and you have to think about efficiency and logisitcs of different approaches. If the data is not large, you can read all n files into a list and then combine. If data is very large, you may wish to read one file at a time, combining and then deleting it before reading

[R] Writing a single output file

2010-12-23 Thread Amy Milano
Dear R helpers! Let me first wish all of you Merry Christmas and Very Happy New year 2011 Christmas day is a day of Joy and Charity, May God make you rich in both - Phillips Brooks ##

Re: [R] Writing a single output file

2010-12-23 Thread jim holtman
This should get you close: # get file names setwd('/temp') fileNames - list.files(pattern = file.*.csv) fileNames [1] file1.csv file2.csv file3.csv file4.csv input - do.call(rbind, lapply(fileNames, function(.name){ + .data - read.table(.name, header = TRUE, as.is = TRUE) + # add

Re: [R] Writing a single output file

2010-12-23 Thread Hadley Wickham
input - do.call(rbind, lapply(fileNames, function(.name){ +     .data - read.table(.name, header = TRUE, as.is = TRUE) +     # add file name to the data +     .data$file - .name +     .data + })) You can simplify this a little with plyr: fileNames - list.files(pattern = file.*.csv)

Re: [R] Writing a single output file

2010-12-23 Thread Gabor Grothendieck
On Thu, Dec 23, 2010 at 8:07 AM, Amy Milano milano_...@yahoo.com wrote: Dear R helpers! Let me first wish all of you Merry Christmas and Very Happy New year 2011 Christmas day is a day of Joy and Charity, May God make you rich in both - Phillips Brooks ##