dimanche 19 février 2023

r generate random poisson values

How do I randomly generate 50% 1s, 30% 2s, 15% 3s and remaining 4s ?

Finally when I do a table , table(x, useNA = "ifany"), it should be

                         1      2      3    4
                         50     30     15   5

I am not sure how to use rpois to generate this.




Aucun commentaire:

Enregistrer un commentaire