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);
}


- G.V.

______________________________________________
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.

Reply via email to