Is R simply faster on Linux? (Part 1)

Is R simply faster on Linux? (Part 1)
Photo by Joshua Reddekopp / Unsplash

Let me begin with a quick disclaimer. I have been using R for a few years now. When I was working on my dissertation, I began learning the language and would consider myself to be something more than a novice with R. I do know some work arounds to possible error messages, but I would not categorise myself as an expert in troubleshooting problems in R. My office machine runs an Intel core i5 processor with 16 GB of RAM and 256 GB SSD. I recently ungraded my OS to Windows 11.

The configuration of my work machine

As a ‘tech enthusiast’ myself, I keep finding myself in situations where I experiment a lot with the operating system that I use to make me the ‘most productive’ version of myself. By that, I mean I was constantly juggling between Windows, different versions of Linux, and OSX on my daily driver computer. All this came to an end when I started doing work more serious than writing emails and reading manga. With the start of my doctoral studies at IIM Calcutta, I was forced to make a choice and I had chosen to remain with Windows (10 at the time). When my thesis work started, I used R on Windows (an occasionally on OSX on my MacBook Air).

R on Windows was very good for the most part. It was fast, it ran on the packages I needed, and crashed very rarely. The issue however, did not surface until I had to do a really large ‘balancing act’. To elaborate, R gave up on me when I tried to balance a really large panel dataset using make.pbalanced function in the plm package (Linear Models for Panel Data). R constantly presented me with the “cannot allocate vector of size — GB/MB” error. This was, quite honestly a very irritating situation. For some reason, the issue did not go away with the “memory.limit()” increase. After battling with this issues for a few days, I decided it would be better for me to break down the dataset into 10 parts, balance them, and then put them back together.

Now that I am working again on the same project (to improvise, and potentially publish) I am back to the drawing board to fix some of the issues I had with my code. One thing leads to another, and I end up with the same problem- “cannot allocate vector of size — GB/MB” error”. This time however, I am more determined to solve the memory limit issue. A friend tells me using R on Linux may solve my problem altogether. Therefore, I am considering installing Linux Mint on my work machine. For the lack of a better phrase, my research question here is “Is R on Linux work better than R on Windows”. We shall find out later in the day today.

The error message