Re: [R] sapply function and poisson distribution

2015-01-05 Thread peter dalgaard
On 05 Jan 2015, at 00:21 , Pete Brecknock wrote: > n <- c(1,2,3,4,5) > lambda <- c(0.1,0.8,1.2,2.2,4.2) > > mapply(function(x,y) rpois(x,y), n, lambda) Yes. I'd throw in a SIMPLIFY=FALSE to avoid getting results in a different format if n is constant (then again, sapply() in the original q

Re: [R] sapply function and poisson distribution

2015-01-04 Thread Pete Brecknock
dimnik wrote > thank you for your answer.Yes,that sounds right.I thought the same thing > but the problem is how can i generalize the command for every vector of > numbers not only for the specific example?not only for c(1,2),c(0.1,0.8). > > 2015-01-04 0:45 GMT+00:00 Pete Brecknock [via R] < > ml

Re: [R] sapply function and poisson distribution

2015-01-04 Thread dimnik
thank you for your answer.Yes,that sounds right.I thought the same thing but the problem is how can i generalize the command for every vector of numbers not only for the specific example?not only for c(1,2),c(0.1,0.8). 2015-01-04 0:45 GMT+00:00 Pete Brecknock [via R] < ml-node+s789695n4701358...@n

Re: [R] sapply function and poisson distribution

2015-01-03 Thread Pete Brecknock
dimnik wrote > i want to find a functionthattakes in two vectors of numbers > thathave > the same > length.The output should be a listof vectors, where each vector > is a > sequence of > randomly generated Poisson variableswher