[R] how to divide each column in a matrix by its colSums?

Erich Neuwirth erich.neuwirth at univie.ac.at
Sun Nov 28 22:51:06 CET 2010


sweep(m,1,rowSums(m),"/")
sweep(m,2,colSums(m),"/")




On 11/28/2010 9:55 PM, casperyc wrote:
> 
> In that case, there are values >1,
> which is clearly not what I wanted.
> 
> Thanks.
> 
> I think I should use prop.table
> 
>



More information about the R-help mailing list