Beginner here: I'm trying to apply the prop.test function in r to each row of a dataframe. If I have a large table, how can I apply the function row-wise without referencing each element? I tried the broom::tidy function but this provides only the proportion and I need the 95% confidence intervals.
> a<-data.frame(x=c(1,2,3,4),y=c(5,6,7,8))
> z=rowSums(a)
> b<-cbind(a,z)
> b
x y z
1 1 5 6
2 2 6 8
3 3 7 10
4 4 8 12
# inefficient code:
prop.test(b[1,1],b[1,3])
prop.test(b[2,1],b[2,3])
prop.test(b[3,1],b[3,3])
prop.test(b[4,1],b[4,3])
# doesn't provide 95% confidence intervals
broom::tidy(prop.test(b$x, b$z))