Skip to content

expression as a parameter of binom.test (PR#9288)

2 messages · Petr Savicky, Roger Bivand

#
Full_Name: Petr Savicky
Version: 2.4.0
OS: Fedora Core release 2
Submission from: (NULL) (62.24.91.47)


the error is
Error in binom.test(0.56 * 10000, 10000) : 
        'x' must be nonnegative and integer

while
yields correct result.

The same error occurrs for
#
On Wed, 11 Oct 2006 savicky at cs.cas.cz wrote:

            
Well, do:

binom.test(as.integer(0.56*10000),10000)

then.

storage.mode(0.56*10000) 

is "double", not "integer". Footnote 9 in "An Introduction to R", and in 
the table early in Chapter 2 in "R Language Definition". In fact it is 
another rendition of FAQ 7.31 (is anybody logging a time series of 7.31?):

x <- 0.56*10000
x1 <- 5600
all.equal(x, x1) 
identical(x, x1)

and fails:

x != round(x)

in binom.test; it passes:

!isTRUE(all.equal(x, round(x)))

which might be more graceful.