简体   繁体   中英

prop.test iteratively

I have a situation like this: first of all I have a data.frame:

DF
COL1 COL2
29 1623
27 1600
30 1617
8 1620

Then, I have a vector like this:

  [1] [2] 50 1602 

What I need is to bind the first row of DF with the vector to have:

output

[1] [2]
29 1623
50 1602

On this output I would like to apply the prop.test using this code:

prop.test(output[,1], output[,2], correct=FALSE)

I need to do this on the entire DF, so:

first: bind first row of DF with the vector
second: prop.test
then again
first: bind second row of DF with the vector
second: prop.test

This iteratively.

Any suggestion please?

thanks a lot

apply(DF, 1, function(x) prop.test( rbind(x, c(50, 1602) ) ,correct=FALSE ) )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM