Obtaining NULL confidence intervals and error " provided 565 variables to replace 2 variables" with prop.test function?


Unfortunately, I do not have my work computer, so my ability to provide code is limited but any help would be greatly appreciated.

I am simply trying to export confidence intervals to be used in another programme and my boss has been asking me to do this using the prop.test function. I have 556 columns with two variables (both integers). Essentially, he wants me to run the prop.test function, then import them into back to excel.

I am using the following code to accomplish this:


ii0<-subset(ii,ii$Smoke>0) #to subset the data

res2 <- Map(prop.test,ii0$SmokeMUN,ii0$age18above)

ii0[c("lower","upper")] <- t(sapply(res2,"[[","conf.it"))

Afterwards, I receive this error "In [<-.data.frame(*tmp*, c("lower", "upper"), value = list(NULL, : provided 565 variables to replace 2 variables" when running the code. I am used to R when it comes to running GLMMs (and haven't done so since my research) and I am simply confused regarding why this error is occurring.

In addition, I tried to specify the confidence errors: res<- prop.test(ii0$Smoke,ii0$age, p = NULL, alternative = "two.sided", correct = TRUE, conf.level = 0.9)

but the results are the same. My two variables are a numerator and denominator, and both are integers. Would anyone have any solutions? Or perhaps, another way where I can extract these confidence intervals?

thank you

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.