Re: [R] how to read in multiple files with unequal number of columns

2008-04-28 Thread Prof Brian Ripley
With the help of some reproducible code from Tania I traked this down. She started with all=NULL as the first argument, and merge() was failing when there were no common columns and no rows in one of the inputs (as expand.grid failed). I've fixed that in R-patched. Using all for your object w

Re: [R] how to read in multiple files with unequal number of columns

2008-04-23 Thread jim holtman
Is this what you want? I am assuming that you will read the dataframes into a list and then process them like below: > # put dataframe in a list -- would have read them in via a list > x <- list(d, my.fake.data) > # determine maximum number of columns and then pad out the short one > # also use t

Re: [R] how to read in multiple files with unequal number of columns

2008-04-23 Thread Tania Oh
Thank you John. It was useful to know about this package. I tried merge_all and I got this error: Error in .subset2(x, i, exact = exact) : subscript out of bounds It could be due to the way my data is and I will try the other solutions suggested by the other kind souls on this list. Best wish

Re: [R] how to read in multiple files with unequal number of columns

2008-04-22 Thread John Kane
You might want to have a look at the merge_all function in the reshape package. --- Tania Oh <[EMAIL PROTECTED]> wrote: > Dear all, > > I want to read in 1000 files which contain varying > number of columns. > For example: > > file[1] contains 8 columns (mixture of characters > and numbers) > f

Re: [R] how to read in multiple files with unequal number of columns

2008-04-22 Thread Tania Oh
Thanks Ingmar, but when I used merge in : all <- merge(all, tmp), I get an error: Error in rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) : invalid 'times' value is the error because of the way I initialised 'all'? what is the correct way of using merge in this case? thanks ta

Re: [R] how to read in multiple files with unequal number of columns

2008-04-22 Thread Ingmar Visser
you may be looking for ?merge hth, Ingmar On 22 Apr 2008, at 15:05, Tania Oh wrote: > Dear all, > > I want to read in 1000 files which contain varying number of columns. > For example: > > file[1] contains 8 columns (mixture of characters and numbers) > file[2] contains 16 columns etc > > I'm rea

[R] how to read in multiple files with unequal number of columns

2008-04-22 Thread Tania Oh
Dear all, I want to read in 1000 files which contain varying number of columns. For example: file[1] contains 8 columns (mixture of characters and numbers) file[2] contains 16 columns etc I'm reading everything into one big data frame and when I try rbind, R returns an error of "Error in rbind