> If I want to divide the column of a matrix by the sum of the column, should I
> loop over the columns or can I use apply family?

Looping's unnecessary.
See ?scale  or ?sweep, with  ?colSums for two non-looping answers; apply() also 
works if you give it a suitable function argument.

S



*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}

______________________________________________
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