I am trying to compare the prescribing of 7 medications pre and post an intervention in 3 groups. I have columns for each other medications with flags of 1 or 0 if prescribed and labels that are pre_econ, post_econ, pre_nocon, post_nocon, pre_inp, post_inp.
The data are formatted like this:
I would like to compare the change in prescribing of the medications (flag = 1) for each other groups so I would get something like this:
I tried prop.table but I do not know how to take the calculated percentages and make a change (from pre post) or how to compare the change.