简体   繁体   中英

Saving data from replicated simulations in R

I created a small function that generates a table of Data. Then, I want R to replicate this function many times, so I included my function inside a "replicate()" function. This seems to work great.

Now, I want to save the results of every simulation in one table. I've tried rbind, data.table etc... but clearly I am doing it wrong.

replicate(100,{object<-function{....
results<-(table of results)
}})

I don't know if I understand corectly but the easiest thing for me is use some condinional function. For example:

i<-1
main.table<-data.frame()

while (i<=100) {
object<-function (...)
main.table<-rbind(main.table,object) 
i<-i+1
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM