The ways to lean the script

Hello everyone,

I am handling with script which use a lot of data in processing and I need to reduce the working time of these script. Could you recommend me some guides/articles/books/other publications where can I find some tips how can I lean my script?

thanks

You should start with profiling your code to see what takes longest time.
There are two chapters in Advanced R on that, so it's a good place to start - https://adv-r.hadley.nz/perf-measure.html

1 Like

Thank you! You are great!

1 Like

If you're dealing with datasets, consider using the data.table package. It's goal is to be fast and memory efficient, and it achieves that gloriously.

Also, check out The R Inferno, specifically chapters 2 (Growing Objects) and 3 (Failing to Vectorize).

The Efficient R Programming online book is another good resource after you have done profiling.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.