Press "Enter" to skip to content

Category: R

Draw Economist-Style Graphs in R

Ozancan Ozdemir replicates a style:

I think everyone agrees on the fact that the Economist magazine produces very-well designed graphics, sometimes the best in the world. The success behind their graph lies on the ability of explaining complex matters in a simpler way by employing traditional data visualization techniques such as line graph or bar plot. They put emphasis on the message they want to convey rather than the aesthetics of the graph itself. They also have a clear hiearchy in their plots and use colors, fonts and lines which represents the brand identity of the magazine.

In this tutorial, we are going to create an Economist-style graph in R by using ggplot2ggthemesshowtextggtextand grid packages. I am going to use a dataset that I have been collecting since 2014 about the poverty line and minimum wage in Turkey, but you can adopt these codes to any dataset you want to visualize.

Click through to learn how.

Leave a Comment

Exploring Associations in R with AssociationExplorer

Antoine Soetewey announces a new tool:

I am pleased to announce the publication of our paper “AssociationExplorer: A user-friendly Shiny application for exploring associations and visual patterns” in the journal SoftwareX, together with the official release of the AssociationExplorer2 R package on CRAN.

Both the paper and the software are part of an open-science effort aimed at making exploratory data analysis more accessible to non-technical users.

Read on to learn more about the tool and how you can get it. H/T R-Bloggers.

Leave a Comment

Using Haskell for Data Science

Jonathan Carroll has my attention:

I’ve been learning Haskell for a few years now and I am really liking a lot of the features, not least the strong typing and functional approach. I thought it was lacking some of the things I missed from R until I found the dataHaskell (www.datahaskell.org) project.

There have been several attempts recently to enhance R with some strong types, e.g.  vapour (vapour.run), typr (github.com), using {rlang}’s checks (josiahparry.com), and even discussions about implementations at the core level e.g.  in September 2025 (stat.ethz.ch) continued in November 2025 (stat.ethz.ch). While these try to bend R towards types, perhaps an all-in solution makes more sense.

In this post I’ll demonstrate some of the features and explain why I think it makes for a good (great?) data science language.

I’ve been a big fan of F# for data science work as well for similar reasons, so it was interesting to read this article on Haskell. H/T R-Bloggers.

Leave a Comment

Getting ML Services Running on SQL Server 2025

Greg Low takes a look at ML Services:

This is an update of a post that I wrote for SQL Server 2022 . Unfortunately, those instructions needed to be updated, not because anything notable has changed in SQL Server 2025, but because the recent distribution of Python has changed. Thanks to Peter Bishop for reporting what was now missing.

I hope that the versions Greg mentions—R 4.2 and Python 3.10—aren’t the latest that SQL Server supports, because those are both woefully out of date. Python 3.10 came out almost 4 years ago and R 4.2 is almost 3 years old at this point.

Leave a Comment

Accessing Home Assistant’s InfluxDB Instance from R

Martin Stingl looks for some data:

I’m running a HomeAssistant instance at home. I’ve configured it to log data into an InfluxDB database, so I can retrieve historical data for analysis later on. In default mode HomeAssistant would aggregate historical data for storage reasons.

So now I want to access the InfluxDB database from R to perform custom analyses. HomeAssistant is still using InfluxDB version 1. To connect to InfluxDB from R, I thought I can use the influxdbr package. But I got some errors because this package seems to be outdated.

Read on for the error message and how Martin was able to get around this. H/T R-Bloggers.

Comments closed

Finding Substrings in Pi

Tomaz Kastrun has some fun with Pi:

We will do this in the following steps (for the word “eggs”):

  1. Encode the word EGGS to numbers. E = 5, G = 7, G = 7 and S = 19. Together concatenated we get the string of 57719.
  2. We store a veeery long string of PI number.
  3. Start looking in PI number for substring of “57719”.

Click through for the R code.

Comments closed

Creating Your Own ggplot2 Geom

Isabella Velasquez is feeling creative:

If you use ggplot2, you are probably used to creating plots with geom_line() and geom_point(). You may also have ventured into to the broader ggplot2 ecosystem to use geoms like geom_density_ridges() from ggridges or geom_signif() from ggsignif. But have you ever wondered how these extensions were created? Where did the authors figure out how to create a new geom? And, if the plot of your dreams doesn’t exist, how would you make your own?

Enter the exciting world of creating your own ggplot2 extensions.

The post looks a lot like a series of slides, and it takes you through the process of creating a new geom. H/T R-Bloggers.

Comments closed

Building a Pyramid in R

Tomaz Kastrun has fun generating a triangle:

What motivates human behaviour can be captured in the Maslow’s hierarchy of needs (source: Wiki). Maslow and psychologists have articulated these needs in a form of a Pyramid, and ever since the concept had been widely adopted (also criticised), and yet, another adaptation is the Pyramid of R needs

Read on for Tomaz’s take, as well as how to generate such a pyramid.

Comments closed

Using Dygraphs in R

Thomas Williams builds a chart:

I also wanted to get a little interactive with my analysis, and came across Dygraphs for R https://rstudio.github.io/dygraphs/ which wraps the “venerable” (according to creator Dan Vanderkam https://github.com/danvk) javascript charting library of the same name, first released in 2006.

I used Dygraphs in an R script file (it can work equally well in R Markdown) to quickly chart my time series data, loaded from the CSV file. Dygraphs were simple to use, are a solid pick among other charting libraries and very functional for being free and open source.

Read on for a few examples of charts, as well as the entirety of Thomas’s code.

Comments closed

Generative Additive Models for Customer Lifetime Value Estimation

Nicholas Clark builds a GAM:

I typically work in quantitative ecology and molecular epidemiology, where we use statistical models to predict species distributions or disease transmission patterns. Recently though, I had an interesting conversation with a data science PhD student who mentioned they were applying GAMs to predict Customer Lifetime Value at a SaaS startup. This caught my attention because CLV prediction, as it turns out, faces remarkably similar statistical challenges to ecological forecasting: nonlinear relationships that saturate at biological or business limits, hierarchical structures where groups behave differently, and the need to balance model flexibility with interpretability for stakeholders who need to understand why the model makes certain predictions.

This is an interesting article and I had not thought of using a GAM for calculating Customer Lifetime Value. I used a much simpler technique the one time I calculated CLV in earnest. H/T R-Bloggers.

Comments closed