I am wanting to do a 2 sample proportions test in R using a loop and split by Health Center and by Measure. Below is a link to show an example of how my data is set up (The website would not allow me to upload an image of my dataset)
Basically, I want to compare the Health Center A's with Measure A's using the prop.test function and repeat this for all my health centers (29 of them) and measures (14 of them). I am just not sure on what the code would be to loop this so it does all the proportion tests that I want and split it how I want.
Any help would be greatly appreciated!
I went ahead a deleted all the 0's. However, my code worked but did not split the data how I wanted it to. I was hoping it would split by health center and then by measure but instead it splits just by health center so I have 28 measures the prop.test is analyzing instead of just health center A with Measure A. See output example below: