-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
@jaseeverett, I notice in the programming section, we teach people to use for loops. For parallel processing, it is much better to be using lapply.
We could also use foreach.
Moving from a for loop to lapply or foreach is a major refactor, because the for loop expects variables outside the loop to be initialised, and expects to be modifying those variables during the loop. lapply and foreach create a new scope inside, so that generally you use them as functions that take inputs and return lists.
Moving from lapply to parLapply or future_lapply is only a minor refactor, with an extra line of code at the start of the script to specify the parallel model.
Metadata
Metadata
Assignees
Labels
No labels