Re: [R] mergeing a large number of large .csvs

2012-11-08 Thread Uwe Ligges
On 06.11.2012 05:24, Benjamin Caldwell wrote: Thanks to you all. Modifying the code to use rbind instead of merge worked like a charm - I can only speculate why. Because merge is not intended for appending. See its help page. Uwe Ligges Best *Ben Caldwell* PhD Candidate University of Cal

Re: [R] mergeing a large number of large .csvs

2012-11-05 Thread Benjamin Caldwell
Thanks to you all. Modifying the code to use rbind instead of merge worked like a charm - I can only speculate why. Best *Ben Caldwell* PhD Candidate University of California, Berkeley 130 Mulford Hall #3114 Berkeley, CA 94720 Office 223 Mulford Hall (510)859-3358 On Sat, Nov 3, 2012 at 2:19 P

Re: [R] mergeing a large number of large .csvs

2012-11-03 Thread jim holtman
It easier than that. I forgot I can do it entirely within R: setwd("/temp/csv") files <- Sys.glob("daily*csv") output <- file('Rcombined.csv', 'w') for (i in files){ cat(i, '\n') # write out file processing input <- readLines(i) input <- input[-1L] # delete header writeLines(inp

Re: [R] mergeing a large number of large .csvs

2012-11-03 Thread jim holtman
These are not commands, but programs you can use. Here is a file copy program in "perl" (I spelt it wrong in the email); This will copy all the files that have "daily" in their names. It also skips the first line of each file assuming that it is the header. perl can be found on most systems.

Re: [R] mergeing a large number of large .csvs

2012-11-03 Thread Benjamin Caldwell
Jim, Where can I find documentation of the commands you mention? Thanks On Sat, Nov 3, 2012 at 12:15 PM, jim holtman wrote: > A faster way would be to use something like 'per', 'awk' or 'sed'. > You can strip off the header line of each CSV (if it has one) and then > concatenate the files t

Re: [R] mergeing a large number of large .csvs

2012-11-03 Thread jim holtman
A faster way would be to use something like 'per', 'awk' or 'sed'. You can strip off the header line of each CSV (if it has one) and then concatenate the files together. This is very efficient use of memory since you are just reading one file at a time and then writing it out. Will probably be a

Re: [R] mergeing a large number of large .csvs

2012-11-03 Thread Jeff Newmiller
On the absence of any data examples from you per the posting guidelines, I will refer you to the help files for the melt function in the reshape2 package. Note that there can be various mixtures of wide versus long... such as a wide file with one date column and columns representing all stock p

Re: [R] mergeing a large number of large .csvs

2012-11-03 Thread Benjamin Caldwell
Jeff, If you're willing to educate, I'd be happy to learn what wide vs long format means. I'll give rbind a shot in the meantime. Ben On Nov 2, 2012 4:31 PM, "Jeff Newmiller" wrote: > I would first confirm that you need the data in wide format... many > algorithms are more efficient in long forma

Re: [R] mergeing a large number of large .csvs

2012-11-02 Thread Jeff Newmiller
I would first confirm that you need the data in wide format... many algorithms are more efficient in long format anyway, and rbind is way more efficient than merge. If you feel this is not negotiable, you may want to consider sqldf. Yes, you need to learn a bit of SQL, but it is very well integ

[R] mergeing a large number of large .csvs

2012-11-02 Thread Benjamin Caldwell
Dear R help; I'm currently trying to combine a large number (about 30 x 30) of large .csvs together (each at least 1 records). They are organized by plots, hence 30 X 30, with each group of csvs in a folder which corresponds to the plot. The unmerged csvs all have the same number of columns (5)