[R] Data contamination

Wu Gong wg2f at mtmail.mtsu.edu
Mon Oct 18 05:53:03 CEST 2010


Hi,

You are right, runif(5,1,50) could generate a same value twice. And I think
that your code runs runif(5,1,50) twice too. Try ?sample

selected <- sample(1:50,3)
data.sim[selected,1] <- data.sim[selected,1] + rnorm(5, mean=20, sd=1) 

Hope it helps.

-----
A R learner.
-- 
View this message in context: http://r.789695.n4.nabble.com/Data-contamination-tp2999622p2999636.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list