Last chance! 50% off unlimited learning
Sale ends in
sweep(x, margin, margin.table(x, margin), "/")
for newbies, except that if margin
has length zero, then one
gets x/sum(x)
.
prop.table(x, margin = NULL)
x
expressed relative to margin
margin.table
m <- matrix(1:4, 2)
m
prop.table(m, 1)
Run the code above in your browser using DataLab