Re: [R] Writing a single output file

2010-12-30 Thread Hadley Wickham
molten data: date > > # If I try to change it as > > cast(in.melt, date.yield_rate ~ file)    # Gives following error. > Error: Casting formula contains variables not found in molten data: > date.yield_rate > > Sir, it will be a >  great help if you can guide me and once again

Re: [R] Writing a single output file

2010-12-29 Thread Amy Milano
n data: date.yield_rate Sir, it will be a great help if you can guide me and once again sinserely apologize for reverting so late. Regards Amy --- On Thu, 12/23/10, jim holtman wrote: From: jim holtman Subject: Re: [R] Writing a single output file To: "Amy Milano" Cc: r-hel

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 t

Re: [R] Writing a single output file

2010-12-23 Thread Gabor Grothendieck
On Thu, Dec 23, 2010 at 8:07 AM, Amy Milano 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 > > ## >

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.*.c

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

[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 ## ---