[R] Merge matrices with different column names

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Fri Oct 26 06:15:12 CEST 2012


If they have the same number of rows, you can use cbind() to create one object to write out.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Charles Determan Jr <deter088 at umn.edu> wrote:

>A general question that I have been pursuing for some time but have set
>aside.  When finishing some analysis, I can have multiple matrices that
>have specific column names.  Ideally, I would like to combine these
>separate matrices for a final output as a csv file.
>
>A generic example:
>
>Matrix 1
>var1A          var1B          var1C
>x                      x               x
>x                      x               x
>
>Matrix 2
>var2A          var2B          var2C
>x                      x               x
>x                      x               x
>
>I would like a final exportable matrix or dataframe or whichever format
>is
>most workable.
>
>Matrix 3
>var1A          var1B          var1C
>x                      x               x
>x                      x               x
>
>var2A          var2B          var2C
>x                      x               x
>x                      x               x
>
>However, no matter which function I try reports an error that the
>column
>names are not the same.
>
>Any insights would be appreciated.
>Thanks as always,
>Charles
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list