[R] How to generate fake population (ie. not sample) data?

CB cb.lists at gmail.com
Wed Mar 4 10:50:41 CET 2009


2009/3/4 Daniel Nordlund <djnordlund at verizon.net>:
> Something like this may help get you started.
>
> std.pop <- function(x,mu,stdev){
>  ((x-mean(x))/sd(x)*stdev)+mu
>  }
>
> population <- std.pop(rnorm(1000),10,5)
>
> Hope this is helpful,
>
> Dan

Very helpful. I hadn't thought of a simple roll-your-own approach, and
was instead trying to find something built-in. Thanks.




More information about the R-help mailing list