On Sun, 11 Jul 2010, Robin Jeffries wrote:
I know this is a simple question, but I have yet to master the apply
statements. Any help would be appreciated.
You don't want to use apply() here: rbinom is vectorized. However, you
cannot use mat$x on a matrix, and the cbind() gave you a matrix
an
Hello Robin,
I cannot quite figure out what your final goal is (it's late and I'm
low on caffeine so if I missed the obvious, bear with me). I think
you may mean the rbinom() function rather than the binomial() function
(see ?rbinom and ?binomial, respectively). At any rate, this should
get you
I know this is a simple question, but I have yet to master the apply
statements. Any help would be appreciated.
I have a column of probabilities and sample sizes, I would like to create a
column of binomial random variables using those corresponding probabilities.
Eg.
mat = as.matrix(cbi
3 matches
Mail list logo