vectorized doSimulation file

1 view
Skip to first unread message

Daniel Gates

unread,
Jun 6, 2012, 5:44:01 PM6/6/12
to treevo-...@googlegroups.com
Greetings, I've run through the doSimulation.R file and pulled out all the for loops and replaced them with apply functions. Currently this file works when I run a test file through it (see the doSimulation folder in the dropbox) and I've added it to my branch if you'd like to run it through TreEvo. It's still a work in progress, one loop in particular had multiple important items and to make get everything up and running I made one a global object (with <<-) but I'm pretty sure that's frowned upon in the R world (I think I have an idea why but if anyone can share a good example of how global objects cause problems that would be nice :D ), so I'm currently weighing the importance of that change ( I also ran into a bit of trouble with that same function returning nulls that took a bit of extra code to remove).

I've also placed the function calls at the beginning so they are not repeatedly "recreated" in the loops, I don't know if this is a concern, as far as code annotation goes it could be annoying looking at all the apply functions without the function they're calling anywhere nearby so if anyone has insights on that I'd be happy to hear it.

Cheers!
-Dan


Reply all
Reply to author
Forward
0 new messages