aliquote.org

R 4.0

May 19, 2020

R 4.0 was released a few weeks ago. I installed it yesterday and everything went smoothly as expected. Indeed, Dird Edelbuettel already showed how easy upgrading R was in one of his recent R4 post. In my case, I installed R from scracth, meaning I let the installer erase my old library folder and reinstalled a bunch of packages after all. I no longer use a separate lib directory for a long time now.

Anyway, it’s quite amazing that a statistical package that I once tested back in 2000 when the 1.0 was released still works out of the box. Not only the core language, but also the numerous packages that were developed alongside, which remain archived as tarballs on CRAN in case they are no longer maintained. As far as I am concerned, it has replaced Sed and Awk, grep, but also Gnuplot, more than one time.

The main changes are detailed in the blog post referenced above. This includes the stringAsFactors thing that was quite annoying if you were not involved in experimental design-oriented datasets or were too lazy to add an options(stringAsFactors = FALSE) in your R profile file. It’s still available if you were wondering, btw. There has been a lot of enhancement behind the door thanks to Luke Tierney, and not only for this release (think of altrep, for instance). As much as I miss LispStat, I can only rejoice in his contribution to the R ecosystem. The default palette has been revised and it is now possible to use custom color scheme for base R plots. I added the following line in my .Rprofile:

.First <- function() grDevices::palette("Tableau10")

On a related point, I tried the language server for Emacs. For almost 15 years I used to use ESS exclusively, but now that I learned that you can use those two packages at the same time via a hook,1 why not benefit from the best of both worlds? At the time of this writing, the language server protocol is still lacking some functionalities like the reference provider (the definition provider works fine, though) or code action and lens utilities. There’s no rename facility, nor execute command but since we have iESS this not a big deal. We get linting and symbol highlighting for free, but the signature and completion helpers are far better than their ESS counterparts, IMO. Here’s a quick peak at the language server in action, regarding help display (left, as ESS does via Eldoc; right, via lsp-ui):

Overall, I find this package quite handy and it is obviously lighter than MS Python language server.2

♪ Leonard Cohen • Live in London


  1. Unfortunately, this hooking technique cannot be used to complement ESS for Stata with Bill Rising’s ado-mode, which is far better at syntax highlighting but only targets GUI version of Stata. ↩︎

  2. I stopped using the standard LSP package because I was tired of incompatibility with pip versions of jedi, languageserver, and all the dependencies. At some point, I wondered why the language server is not bundled with the Emacs package as is the case for Julia. ↩︎

See Also

» Emacs Org-mode and literate programming » Handy command-line utilities » Wolfram Engine and Jupyter » Stata, Emacs and Jupyter » On comparing trees