r - Simulation data using a dataframe -
r - Simulation data using a dataframe -
i want simulate existing dataset best model.considering next dataset , want create 100 or 1000 sample using info in r. help?
x<-data.frame( a=c("a","b","m","n","p"), b=c("g","n","p","r","i"), c=c("t","f","l","u","u"), d=c(9,12,13,13,12), e=c(14,17,10,19,10), f=c(10,12,19,17,15), g=c(7,12,10,14,15), h=c(18,19,19,12,12), i=c("k","l","m","f","d"), j=c("c","v","o","n","f"), k=c("g","n","p","p","i"))
if want 1000 info sets, seek putting them list this.
lapply(1:1000, function(i, x) x[sample(nrow(x), size=1000, replace=true), ], x) although i'm not sure value of using simulated info sets of size 1000 sample of fewer observations. believe ben bolker's recommendation of size=nrow(x) more sound way approach this.
r
Comments
Post a Comment