I'm trying to conduct a series of two-sample proportion tests across all rows of a data frame. Here is an example of first 3 rows, where x is the coiunt of yes responses and n is the total.
df <- data.frame("x1" = c(370,450,490), "x2" = c(150, 970, 120), "n1" = c(1500, 2700, 4500), "n2" = c(3000, 4900, 3200))
I'm using the function "prop.test" which compares two proportions as below:
test <- prop.test(x = c(370, 150), n = c(1500, 3000), correct = "FALSE")
I've tried:
Map(prop.test, x = c(df$x1, df$x2), n = c(df$n1, df$n2), correct = "FALSE")
but it is returning output for 6 rows of 1-sample binomial tests instead of output for 3 rows of 2-sample binomial tests. I must be using Map incorrectly. Any ideas?