What's an elegant way to calculate the ratio of two columns (NAs included) across all groups? Let's say we have this data:
Name Col1 Col2
Abe 2 3
Abe 1 2
Brad 2 1
Brad 2 2
Chuck 1 1
Chuck 3 3
To calculate the ratio of Col:Col2 for each Name, we first add the values for each name per column before obtaining the ratio.
In this case, our answer is:
Name Col1/Col2
Abe 3/5
Brad 4/3
Chuck 4/4