[ESS] Have M-x R point at the most recent version of R

Dominic Steinitz |dontgetoutmuch @end|ng |rom gm@||@com
Wed Oct 4 14:28:46 CEST 2023


I have been meaning to reply to this for some time and maybe a partial answer now is better than a complete answer in several months time.

I use envrc https://github.com/purcell/envrc with direnv https://direnv.net/ and nix https://nixos.org/. With these I can have a different R (and different packages) in each project I work on and emacs and any shells automatically pick up this version and required libraries. Just to be clear I can have different versions of R in different projects. I can also have different versions of packages in different projects. And ESS just picks them up without me configuring emacs.

For a project I am working on at the moment I have my R set up as

> let
>   R-with-my-packages = nixpkgs.rWrapper.override{
>     packages = with nixpkgs.rPackages; [
>       ggplot2
>       maps
>       rnaturalearth
>       rnaturalearthdata
>       sf
>       tidyverse
>     ]; };


And all the dependencies for the R packages are made available (e.g. gdal, proj, geos, libtiff) automatically. In this example, I didn’t specify versions and let nix choose them for me so I got e.g ggplot 3.4.2 but I could have specified a different version e.g. a bug fixed version that hasn’t been released to CRAN.

Of course you can use this for much more than R.

PS I want to say thanks to everyone that contributes to ESS and provides help on this email channel. It’s a great tool :-) 

Dominic Steinitz
dominic using steinitz.org
http://idontgetoutmuch.org
Twitter: @idontgetoutmuch


	[[alternative HTML version deleted]]



More information about the ESS-help mailing list