[R] How to use "ifelse" to generate random value from a distribution
alex46015
alex46015 at yahoo.com
Wed Mar 17 21:25:12 CET 2010
I think I figure it out.
ifelse(data1$x==1,rnorm(12,2,1),ifelse(data1$x==2,rnorm(12,-2,1),rnorm(12,110,1)))
Please correct me if I am wrong. Thanks
--
View this message in context: http://n4.nabble.com/How-to-use-ifelse-to-generate-random-value-from-a-distribution-tp1597064p1597102.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list