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.