Entering edit mode
5.1 years ago
whaiyu06
▴
80
Dear all,
I want to generate a series of random number for the Poisson distribution as below: produce 2 random Possion distribution numbers with the mean is 1; 3 random Possion distribution numbers with the mean is 6; 2 random Possion distribution numbers with the mean is 4; 4 random Possion distribution numbers with the mean is 3 at the same time using R without forloop i.e.
sapply(x,rpois,lambda = y)
but both x and y are vectors ,and I should get a list like
[[1]] rpois(x[1],lambda=y[1]) [[2]] rpois(x[2],lambda=y[2]) .....[[i]] rpois(x[i],lambda=y[i])
Thanks
I moved this from comment to answer since it is the answer to the question.