1

I was given a function that runs analyses on datasets so I'll try my best to explain my problem.

Say I have a function: functionx()

This function will run an analysis on a data matrix: matrixd. However, I need to run functionx() 50 times on matrixd, but I need to save the results from each time I run the function to a different variable, say results1, results2,..., results50.

How would I write a script that would accomplish this?

Brian Lee
  • 39
  • 7
  • 3
    I'm guessing `replicate(50, functionx(x))` would be fine. That creates a list which is going to be way easier to use than a bunch of differently named variables in the long run. you could always convert it with `list2env` if you really need to (and you really don;t). For anything more specific, you really do need to do the work to create a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Talking about code abstractly like this isn't useful or helpful. – MrFlick Sep 23 '14 at 19:59
  • Thanks a lot. Your link was very relevant to my problem, and I'll try my best to make my coding questions more specific in the future. – Brian Lee Sep 23 '14 at 20:26

0 Answers0