mercredi 14 juin 2017

Matrix with randomly generated number that adds up to fixed sum in R

I'm very new to R, and I'm trying to come up with 2x2 matrix with randomly generated numbers between 0 and 10, with a fixed total for the rows and columns, e.g. 20. I.e. the matrix could look something like this:

1 10

4 5

Any pointers will be greatly appreciated!




Aucun commentaire:

Enregistrer un commentaire