[R] Need a variant of rbind for datasets with different numbers of columns

Kirsten Beyer kirsten-beyer at uiowa.edu
Wed Aug 22 22:28:54 CEST 2007


Hello.  I am looking for a function that will allow me to paste rows
together without regard for the numbers of columns in the datasets to
be joined.  The only columns where it matters if they are aligned
correctly are at the beginning - the rest of the columns represent
differing numbers of ICD9 (disease) codes reported by each
person(record) at a health visit.  They are in no particular order.

For example, a result would look like this:

patient          ICD91          ICD92          ICD93
patient A       12345          6789            1543
patient B        3469           9090
patient C       1234

I am trying to accomplish this inside a loop which first identifies
the codes associated with the person and then joins them to the
person.  I have the code working so that it can create a row for each
person, but I can't figure out how to join these rows together!  FYI,
my dataset has 200,000+ people.

Thanks



More information about the R-help mailing list