Dennis,

This works well and is exactly what I wanted for these matrices.  Thank you
very much, however, when I would try to export the resulting list it just
is bound by columns.  Now this isn't so bad for 2 matrices but I hope to
apply this where there are many matrices and scrolling down a file such as
a 'csv' would be desired.  Any thoughts on exporting a list of matrices?

Thanks,
Charles

On Fri, Oct 26, 2012 at 12:00 AM, Dennis Murphy <djmuser@gmail.com> wrote:

> Hi:
>
> You can't represent the same columns with different names in a matrix (or
> data frame, for that matter). If you want to preserve variable names in the
> various matrices and collect them into one R object, I'd suggest creating a
> list, each component of which is a matrix.
>
> Toy example:
>
> m1 <- matrix(1:9, nrow = 3, dimnames = list(NULL, paste0("var", 1:3)))
> m2 <- matrix(rpois(9, 5), nrow = 3, dimnames = list(NULL, paste0("var",
> 4:6)))
> L <- list(m1, m2)
> names(L) <- paste0("matrix", 1:2)
> L
>
> Dennis
>
> On Thu, Oct 25, 2012 at 8:51 PM, Charles Determan Jr <deter088@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@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.
>>
>
>

	[[alternative HTML version deleted]]


