As of now, I simulate 6 variables and manipulate 2 of them. The way my syntax is written my final database is in list mode. I need all of it to be in just 1 database. any help would be MUCH appreciated. Here's my syntax:
fun=function(n, k,rep){ #prepare to store data data=matrix(0,nrow=10*k, ncol=6) db=vector("list",length=rep) #here's the problem for (j in 1:rep){ for (i in 1:k){ #generate data under normal, skewed, and logistic distributions here data[,1]<-seq(1,nrow(data),1) data[,2]<-rep(i,nrow(data)) data[,3]<-rep(n,nrow(data)) data[,4]<-rnorm(n, 100, 15) data[,5]<-rsnorm(n, 100, 15, 1) data[,6]<-rlogis(n, 100, 15) } db[[j]]<-data } DataReturn<<-db return(DataReturn) #DataReturn <- data.frame(matrix(unlist(DataReturn), nrow=rep, byrow=T)) #here's where I tried to solve it unsuccessfully } [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.