Re: [R] matrix column division by vector

2014-05-14 Thread Jeff Newmiller
ig meddelelse >> Fra: carol white >> Dato:14/05/2014 16.53 (GMT+01:00) >> Til: r-h...@stat.math.ethz.ch >> Emne: [R] matrix column division by vector >> >> Hi, >> What is the elegant script to divide the columns of a matrix by the >> respective

Re: [R] matrix column division by vector

2014-05-14 Thread Ted Harding
Br. Frede > > > Sendt fra Samsung mobil > Oprindelig meddelelse > Fra: carol white > Dato:14/05/2014 16.53 (GMT+01:00) > Til: r-h...@stat.math.ethz.ch > Emne: [R] matrix column division by vector > > Hi, > What is the elegant script to divide t

Re: [R] matrix column division by vector

2014-05-14 Thread Bert Gunter
psed >>5.040.015.06 >> >> David C >> >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >> Behalf Of Jeff Newmiller >> Sent: Wednesday, May 14, 2014 10:28 AM >> To: carol white; carol white; r-

Re: [R] matrix column division by vector

2014-05-14 Thread Bert Gunter
user system elapsed >5.040.015.06 > > David C > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Jeff Newmiller > Sent: Wednesday, May 14, 2014 10:28 AM > To: carol white; carol white;

Re: [R] matrix column division by vector

2014-05-14 Thread David L Carlson
--Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jeff Newmiller Sent: Wednesday, May 14, 2014 10:28 AM To: carol white; carol white; r-h...@stat.math.ethz.ch Subject: Re: [R] matrix column division by vector Please post in plain t

Re: [R] matrix column division by vector

2014-05-14 Thread Jeff Newmiller
Please post in plain text... your email is getting distorted and hard to read by the HTML. I don't know how to use do.call for this, but when you understand how vectors recycle and matrices and arrays are laid out in memory (read the Introduction to R document if not) then the following comes t

Re: [R] matrix column division by vector

2014-05-14 Thread Bert Gunter
gt; Texas A&M University > College Station, TX 77840-4352 > > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of carol white > Sent: Wednesday, May 14, 2014 9:52 AM > To: r-h...@stat.math.ethz.ch > S

Re: [R] matrix column division by vector

2014-05-14 Thread Frede Aakmann Tøgersen
Have a look at ?sweep Br. Frede Sendt fra Samsung mobil Oprindelig meddelelse Fra: carol white Dato:14/05/2014 16.53 (GMT+01:00) Til: r-h...@stat.math.ethz.ch Emne: [R] matrix column division by vector Hi, What is the elegant script to divide the columns of a matrix by the

Re: [R] matrix column division by vector

2014-05-14 Thread David L Carlson
mp;M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of carol white Sent: Wednesday, May 14, 2014 9:52 AM To: r-h...@stat.math.ethz.ch Subject: [R] matrix column division by vector Hi, What is the

[R] matrix column division by vector

2014-05-14 Thread carol white
Hi, What is the elegant script to divide the columns of a matrix by the respective position of a vector elements? m=rbind(c(6,4,2),c(3,2,1)) v= c(3,2,1) res= 6/3   4/2  2/1     3/3   2/2    1/1 this is correct  mat2 = NULL for (i in 1: ncol(m))     mat2 = cbind(mat2, m[,i]/ v[i]) but