In R, type the call that shows each province's sales split across channels as row percentages to 1 dp.
In R, type the call that shows each province's sales split across channels as row percentages to 1 dp.
Answer
round(prop.table(xtabs(amount ~ prov + channel, data = orders), 1) * 100, 1)
xtabs makes the sum grid; prop.table with margin 1 divides each cell by its row total; ON reads 46.6 / 53.4. Margin 2 would be columns.