Hi,

I have a matrix, say 
m=matrix(c(
        983,679,134,
        383,416,84,
        2892,2625,570
        ),nrow=3
)

i can find its row/col sum by

rowSums(m)
colSums(m)

How do I divide each row/column by its rowSum/colSums and still return in
the matrix form?
(i.e. the new rowSums/colSums =1)

Thanks.

Casper

-- 
View this message in context: 
http://r.789695.n4.nabble.com/how-to-divide-each-column-in-a-matrix-by-its-colSums-tp3062739p3062739.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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