This is probably an easier (and faster) way to apply this, but this method works. I think this is also more readable, but this is just my opinion.
myDF <- data.frame(a = seq(1, 50), b = seq(1, 100, 2) , c = seq(1, 200, 4))
for (row in rownames(myDF)) { myDF[row, ] <- myDF[row, ] / sum(myDF[row, ]) }
Note. This requires your growth names to be numbers.
source
share