Re: [R] cbind 3 or more matrices
How can I cbind three or more matrices like A,B and C. This does not work: cbind(A,B,C) -- Thanks, Jim. [[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.
Re: [R] cbind 3 or more matrices
do.call(cbind, list(A, B, C)) On Sat, Jun 4, 2011 at 7:14 PM, Jim Silverton jim.silver...@gmail.com wrote: How can I cbind three or more matrices like A,B and C. This does not work: cbind(A,B,C) -- Thanks, Jim. -- Sarah Goslee http://www.functionaldiversity.org __ 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.
Re: [R] cbind 3 or more matrices
A, B, C should have the same number of rows. mlist = replicate(3, matrix(rnorm(6), 2), simplify=FALSE) names(mlist) = LETTERS[seq_along(mlist)] with(mlist, cbind(A,B,C)) or, do.call(cbind, mlist) HTH, baptiste On 5 June 2011 11:14, Jim Silverton jim.silver...@gmail.com wrote: How can I cbind three or more matrices like A,B and C. This does not work: cbind(A,B,C) -- Thanks, Jim. [[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. __ 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.
Re: [R] cbind 3 or more matrices
Jim - In what sense does cbind(A,B,C) not work? A = matrix(rnorm(10),5,2) B = matrix(rnorm(15),5,3) C = matrix(rnorm(20),5,4) cbind(A,B,C) [,1] [,2] [,3] [,4] [,5][,6] [1,] -0.54194873 -1.1105170 -0.479010 0.619911163 0.1610162 0.49028633 [2,] -0.39289246 0.0752089 1.427386 -0.921868090 -0.7637016 -0.34905125 [3,] -0.07082828 -0.1060497 -1.007713 -0.003673573 -0.8384406 -0.88816295 [4,] 0.22733701 -1.6134894 -1.993654 2.277865363 -2.3599239 -0.21704046 [5,] -0.13809337 0.3443488 -1.384425 0.132130433 0.1345938 -0.04170648 [,7] [,8][,9] [1,] -1.7481451 0.4467964 -0.41358420 [2,] -0.2882922 1.0243662 -0.48263684 [3,] 0.9402479 0.5467952 -0.01922035 [4,] 0.6795783 1.4560765 -0.23013826 [5,] 0.9800312 -1.3462175 -0.77064872 - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Sat, 4 Jun 2011, Jim Silverton wrote: How can I cbind three or more matrices like A,B and C. This does not work: cbind(A,B,C) -- Thanks, Jim. [[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. __ 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.