[R] runif with weights

João Fadista Joao.Fadista at agrsci.dk
Thu May 31 00:00:45 CEST 2007


Dear all,
 
I would like to generate 25 numbers from 1 to 100 but I would like to have some numbers that could  be more probable to come out. I was thinking of the function runif:
runif(25, 1, 100) , but I don´t know how to give more weight to some numbers.
 
Example:
each number from 2 to 10 has the probability of 40% to come out but the probability of each number from 11 to 100 to come out is 60%.
 
 
 
Kind regards and thanks in advance,
João Fadista



More information about the R-help mailing list