From: Michael Pearmain <mpearmain_at_google.com>

Date: Fri, 20 Jun 2008 10:41:28 +0100

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 20 Jun 2008 - 12:17:16 GMT

Date: Fri, 20 Jun 2008 10:41:28 +0100

I'm having trouble creating a looping variable and i can't see wher ethe
problem arises from any hep gratfully appreciated

First create a table

x<-table(SURVEY$n_0,exposed)

*> x
*

exposed False True Under 16 24 1 16-19 68 9 20-24 190 37 25-34 555 204 35-44 330 87 45-54 198 65 55-64 67 35 65+ 10 8

Now ectors to store counts and column proportions

> xT<-x[,"True"]

*> xF<-x[,"False"]
**> yT<-x[,"True"]/colSums(x)
**> yF<-x[,"False"]/colSums(x)
*

check length for dynamic looping

> length(yT)

[1] 8

now create loop

> for(i in 1:length(yT)){

+ pwr.2p2n.test(2*(asin(sqrt(yT[i]))-asin(sqrt(yF[i]))),n1=xT[i],n2=xF[i])
+ }

Error in pwr.2p2n.test(2 * (asin(sqrt(yT[i])) - asin(sqrt(yF[i]))), n1 =
xT[i], :

number of observations in the first group must be at least 2

this confuses me as if i enter the data as values the procedure works?

Thanks in advance

[[alternative HTML version deleted]]

R-help_at_r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 20 Jun 2008 - 12:17:16 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Fri 20 Jun 2008 - 12:31:01 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*