[R] Binom.test, vector input
David Afshartous
dafshartous at med.miami.edu
Thu Oct 9 21:42:15 CEST 2008
All,
Is it possible to use binom.test with vector input for only one of the
arguments? I was thinking that this would possibly work with sapply but
then it seems that the binom.test function would have to be re-written to
supply defaults for all other arguments.
set.seed(101)
sim.x = rbinom(100, 10, .8) ## generate 100 values distributed B(10, .8)
# test of first sample against H.0: p=.6
binom.test(sim.x[1], n = 10, p = .6, alternative = "greater")
Is it possible to do the same test for all the rest without a loop or
re-writing the binom.test function?
Cheers,
David
> sessionInfo()
R version 2.7.1 (2008-06-23)
i386-apple-darwin8.10.1
locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
>
More information about the R-help
mailing list