Re: [R] Merge matrices with different column names

2012-10-26 Thread arun
plit(new2,","),`[`,2:4)) dat2 #    [,1]   [,2]   [,3]  #[1,] "var1" "var2" "var3" #[2,] "1"    "4"    "7"   #[3,] "2"    "5"    "8"   #[4,] "3"    "6"    "9"   #[5,] &qu

Re: [R] Merge matrices with different column names

2012-10-26 Thread Charles Determan Jr
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

Re: [R] Merge matrices with different column names

2012-10-26 Thread Rui Barradas
Hello, If you just want to write the matrices to a csv file instead of write.csv you can use write.table with options append=TRUE, sep="," and col.names=FALSE. If you want to merge (rbind) them, you can use code similar to pattern1 <- "(^var)[[:digit:]]+(.*$)" pattern2 <- "(^var)_n_(.*$)"

Re: [R] Merge matrices with different column names

2012-10-25 Thread Jeff Newmiller
If they have the same number of rows, you can use cbind() to create one object to write out. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

[R] Merge matrices with different column names

2012-10-25 Thread Charles Determan Jr
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