Hi there

Why Do I Write R Packages?

Yonghui Dong / 2018-02-23


I have authored two R packages so far. One is called MSbox and another is called Miso, and I am on my way developing the third package, which is temporarily named MSimaging.

There are more than 10,000 R packages on CRAN until today. Most of the functions that you can think of have been already realized by various R packages, so why do I bother to write new packages?

A couple of reasons came into my mind.

1.To fulfill my research purposes

My research is largely dependent on mass spectrometry (MS), an reliable and versatile MS-related software is therefore of great importance to me. Unfortunately however, most of the MS-vendor software can be only installed in Windows environment, and apart from that, I have even noticed some fundamental mistakes in some commercial software. So I decided to write the functions myself to fulfill my research purposes.

There are indeed great R packages available and I do use many of them. While the function names of some R packages are so difficult to remember, and every time I have to check the user manual to look for the correct names. I cannot figure out why people like to give a super long function name and mix lower and upper case letters when naming an R function, it is so annoying to remember and type it. In addition, learning/using an existing R package is sometimes more time consuming than writing a package yourself. You need to understand the script, the function and the logic behind, and it is very often that you have to modify the scripts for your specific purposes.

2. To improve my R skill

Having been using R for many years, I am still far from an advanced R user. Writing an R package offers me great opportunities to improve my R skills, including writing an (efficient) R function and submitting an R package.

R is an open source software and everyone can submit R packages to CRAN. On the other hand it means that R package quality cannot be guaranteed. Therefore I would prefer to write some of the functions myself when possible. I really enjoy writing and debugging R scripts.

3. To contribute R and Research communities

Regardless of the large amount of R packages available, I can still contribute to the R and research communities by writing new packages. For instance, my lab developed a novel research approach, but the related data analysis tool is missing. Not all researchers can write packages themselves, so why not help them?

4. To kill my spare time

Another great reason, right?