Re: [R] Problem using apply

2010-06-01 Thread Sarah Goslee
work no ? > > > > From: Henrique Dallazuanna [mailto:www...@gmail.com] > Sent: Tuesday, June 01, 2010 7:34 PM > To: Joachim de Lezardiere > Cc: r-help@r-project.org > Subject: Re: [R] Problem using apply > > > > The mean by col and by row are the same: > > colMean

Re: [R] Problem using apply

2010-06-01 Thread Joachim de Lezardiere
: Re: [R] Problem using apply The mean by col and by row are the same: colMeans(m) == rowMeans(m) So: m / rowMeans(m) # You don't need apply here m / colMeans(m) On Tue, Jun 1, 2010 at 2:26 PM, Joachim de Lezardiere wrote: Hello , I can not get apply function to do what I want when

Re: [R] Problem using apply

2010-06-01 Thread Peter Langfelder
Well, your example matrix is symmetric, so row and column operations naturally return the same values. You may want to note though that if you apply your function to a matrix along rows, the results will be stored in the __columns__ of the resulting matrix. Thus, if you want to simply divide the r

Re: [R] Problem using apply

2010-06-01 Thread Henrique Dallazuanna
The mean by col and by row are the same: colMeans(m) == rowMeans(m) So: m / rowMeans(m) # You don't need apply here m / colMeans(m) On Tue, Jun 1, 2010 at 2:26 PM, Joachim de Lezardiere < joachim.lez...@gmail.com> wrote: > Hello , > > > > I can not get apply function to do what I want when doi

[R] Problem using apply

2010-06-01 Thread Joachim de Lezardiere
Hello , I can not get apply function to do what I want when doing stuff on rows. Let's say I want to divide the rows of matrix by their mean, the below show you get the same result weather you use 1 or 2, i.e. same result for columns than for means..:( Thanks a lot for the help,