Skip to content
Prev 170092 / 398506 Next

Generating Numbers With Certain Distribution in R

On Wed, Feb 11, 2009 at 2:15 PM, Ben Bolker <bolker at ufl.edu> wrote:
No.
Bernardo misplaced the parenthesis around (x-min(x))
Correct version is:

x <- rlnorm(1e6,meanlog=1,sdlog=1) ## pick any parameters you like
y <- round((x-min(x))/diff(range(x))*199999+1)


/Gustaf