Internal R package for Walmart Chile

While working at Walmart Chile, I led the development of an internal R package to accelerate and streamline the delivery of analyses and data products, inspired by the successful experience of the Airbnb data team with their Rbnb internal package.

The benefits that our package provided include the following:

  • Simplifying the connection to our Data Warehouse from R/RStudio via helper R functions (e.g. connect_to_dwh()). These functions leveraged the usethis R package to provide step-by-step guidance when the connection was set up for the first time (for example, explaining how to save the credentials as environment variables).

  • Abstracting away the complexity of long and frequent SQL queries through R wrappers that exposed only the relevant parameters (e.g. date ranges and other filters) as function arguments. This also had the benefit of putting our most used queries under version control and promoting querying best practices: if you were new to our team you just executed, let’s say, the function get_sales_by_store(q = "2019Q1") and you were already using the best-known SQL query to get the sales by store.

  • Accelerating the delivery of periodic and time-consuming reports that were too complex to be implemented as Tableau dashboards, thanks to the implementation of R Markdown templates. Also, by using PowerPoint as output (a nice feature of R Markdown), we made it easy for our internal business customers to make changes on top of these reports.

The code itself can’t be shared since the package was internal, but here are the slides (in Spanish) of a public talk we gave at the 2019 Latin R conference explaining its features and motivation:

Francisco Yirá
Francisco Yirá
Data Scientist and Economist

R, Python, causal inference, machine learning, data visualisation.