How to Write Production-Ready R Code: Tools and Patterns
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
This talk was presented virtually at eRum 2020 and useR 2020 by Appsilon engineer Marcin Dubel. Here is a direct link to the video.
Be Proud of Your Code!
In this talk you’ll learn the tools and best practices for making clean, reproducible R code in a working environment ready to be shared and productionized. I cover the benefits of git, plumber, RStudio Connect, assertr, linter, renv, and many other tools and concepts.
R is a great tool for fast and efficient data analysis. Its simplicity in setup combined with powerful features and community support makes it a perfect language for many subject matter experts (e.g., in finance or bioinformatics). Nevertheless, what is often the case is that while the code provides a great solution, the application or model is not easily distributed to other team members or interested parties outside the team.
Both Appsilon and I personally have taken part in many R projects for which the goal was to clean and organize the code as well as the project structure. Data science teams working for our clients have all the expert knowledge and skills required to deliver value, but they are missing the programming experience required to provide mature, reproducible and production-quality code.
We would like to share our approach, best practices, and useful tools for creating high-quality R code that you can be proud to share.
During this presentation I will cover:
- setting up the development environment with packrat, renv, and docker
- organizing the project structure
- the best practices in writing R code, automated with linter
- sharing the code using git
- organizing workflow with drake
- optimizing the Shiny apps and data loading with plumber and database
- continuous integration with Github Actions
If you have additional tools and suggestions to share for writing production-ready R code, please let us know in the comments!
Learn More
- Want to learn how to create a computer vision model within an R environment? Watch Jędrzej Świeżewski’s eRum/useR presentation on fast.ai in R.
- Video Tutorial: How to Create and Customize a Simple Shiny Dashboard
- Find more Appsilon Data Science tutorials here.
Does your company need help with enterprise data analytics or Shiny dashboards? Reach out to us at [email protected].
Article How to Write Production-Ready R Code: Tools and Patterns comes from Appsilon Data Science | End to End Data Science Solutions.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.