On Fri, 2009-02-06 at 04:57 -0800, Maithili Shiva wrote: > Hi R helpers, > > > > I have two matrices A and B of the order (4 * 5) and (5 * 3) > respectively. How to multiply these two matrices to obtain resultant > matrix of the order (4 * 3).
?`%*%` E.g.: > A <- matrix(runif(4*5), nrow = 4) > B <- matrix(rnorm(5*3), nrow = 5) > A %*% B [,1] [,2] [,3] [1,] 0.11087765 0.1172641 -1.965684 [2,] 0.08811864 0.6628032 -2.704704 [3,] -0.99875302 1.2822072 -1.388777 [4,] -1.01109686 1.5752980 -1.560827 > > Thanks in advance > > With regards > > Maithili HTH G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
signature.asc
Description: This is a digitally signed message part
______________________________________________ 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.