mardi 29 juin 2021

R Generate random binary vector of fixed length with fixed sum

Quick question: In R, how to generate a random binary vector of fixed length with fixed sum.

For example:

I want a binary vector of length 100 that sum up to 15.

Thanks!




Aucun commentaire:

Enregistrer un commentaire