Code and R scripts optimization


Produce reusable and fast codes

R is a relatively easy language to learn, and a beginner can quickly turn his idea into code to manipulate and analyze data, then produce beautiful visualisations. However, at some point the time comes when one need to produce a fast and maintainable code, rigorously written, with the best practices.

When starting with R to do data analysis, we tend to aim at getting a result as quickly as possible,to get an answer as soon as possible. And yes, you can answer your questions with just a few lines of R code. But is this code reusable? Is this specific piece of code performs well? Have you used the right methods and coding rules?

Using R in production demands a certain set of good practices you have to know and follow if you want your work to be well-performing on the long-run. This includes working with a package, doing version control, mastering the subtle art of documentation, creating unit tests… These software engineering methods help you ensure you are producing sustainable code and outputs of quality.

At ThinkR, when we started using R many years ago, we were, like you, beginners in a context where possibilities to write reproducible and fast code were limited. Today, all the tools are available to make your life easier, your code more understandable and your analysis more efficient. Package creation, continuous integration, tidyverse, parallel calculation …, we are up to date with the latest innovations to improve your existing codes.

If you have troubles finding your way through your codes, if you want to move to another scale but your code is too slow, if you want to share your analysis projects as a package, send us your codes and packages, we will be happy to optimize your methods and give you in the right advices to be a better R programmer.


Use cases on R code optimisation