[R] Translate twobin in S-plus to R?

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Apr 3 14:44:07 CEST 2006


Ulf Emanuelson <Ulf.Emanuelson at kv.slu.se> writes:

> Hi all,
> 
> I'm new to R, but have got the task to translate a short program written 
> for S-plus. I am now stuck on a command twobin which does not seem to be 
> available in R. Anyone know a replacement for this? The syntax used for 
> this command in my code is:
> 
> zobs<-twobin(obstab[1,1],obstab[1,2],obstab[2,1],obstab[2,2],0.05)
> 
> where obstab is a two by two contingency table and the command produces an 
> object (?) with, among other things, a chi2-value.
> 
> Any and all help would be appreciated!

Er, I can't seem to find it in Splus (7.0) either....

There's a twoby2 function in the Epi package. It prints rather than
return an object, but I'm sure it could be modified.

If you just need the chi^2, consider chisq.test(...)$statistic or
prop.test(...)$statistic 

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list