I am trying to divide each cell in a data frame by the sum of the column. For example, I have a data frame df:
sample a b c a2 1 4 6 a3
You can use the transpose of the matrix and then transpose again:
t(t(as.matrix(df))/colSums(df))