powered by
Divides each row by its row sum so that every row sums to 1 (leaving dimnames intact).
rescale_matrix(m)
A numeric matrix of the same dimension with each row summing to 1. Rows with a zero sum are left unchanged (resulting in NaN if present).
NaN
Numeric matrix; rows are biological identities, columns are time bins (i.e., time resources).
ex1_rescale <- rescale_matrix(ex1) rowSums(ex1_rescale)
Run the code above in your browser using DataLab