Re: [R] 2 questions on matrix manipulation in R

2011-08-07 Thread David Winsemius
On Aug 8, 2011, at 12:18 AM, Lei Liu wrote: Hi there, I have two questions on matrix manipulation. For the first one, I want to calculate the product of each column of a matrix (say A) with another vector (say b). That is, if A has 5 columns (a1, a2, a3, a4, a5), I want to obtain a matri

Re: [R] 2 questions on matrix manipulation in R

2011-08-07 Thread Joshua Wiley
Hi Lei, Here are some examples. Look at the documentation for ?"%*%" ?"%o%" and ?"[" with the drop = FALSE argument (in case you ever do select just one column/row of a matrix). ## your first A matrix (A <- matrix(1:55, ncol = 5)) ## you were rather unclear what ## your b vectors dimensions wer