> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Thomas Lumley
> Sent: Thursday, September 17, 2009 6:59 AM
> To: William Revelle
> Cc: r-h...@stat.math.ethz.ch
> Subject: Re: [R] Fastest Way to Divide Ele
On Thu, 17 Sep 2009, William Revelle wrote:
At 2:40 PM +0900 9/17/09, Gundala Viswanath wrote:
I have a data frame (dat). What I want to do is for each row,
divide each row with the sum of its row.
The number of row can be large > 1million.
Is there a faster way than doing it this way?
datno
At 2:40 PM +0900 9/17/09, Gundala Viswanath wrote:
I have a data frame (dat). What I want to do is for each row,
divide each row with the sum of its row.
The number of row can be large > 1million.
Is there a faster way than doing it this way?
datnorm;
for (rw in 1:length(dat)) {
tmp <- dat
I have a data frame (dat). What I want to do is for each row,
divide each row with the sum of its row.
The number of row can be large > 1million.
Is there a faster way than doing it this way?
datnorm;
for (rw in 1:length(dat)) {
tmp <- dat[rw,]/sum(dat[rw,])
datnorm <- rbind(datnorm, tmp
4 matches
Mail list logo