
Last chance! 50% off unlimited learning
Sale ends in
margin.table(x, margin = NULL)
x
is copied to the
output table, except in the summation case.
apply(x, margin, sum)
packaged up for
newbies, except that if margin
has length zero you get
sum(x)
.
prop.table
and addmargins
.
m <- matrix(1:4, 2)
margin.table(m, 1)
margin.table(m, 2)
Run the code above in your browser using DataLab