I'm using Debian Stable (currently Buster) to do my programming in GNU R. As an IDE I'm using both Nvim-R (a vim/neovim-plugin) as well as Emacs+ESS but not Rstudio (although it's a great IDE for getting started).

Since the stability of Debian comes with the price of not having the newest software versions available, I'm on the verge of changing my workflow to not install GNU R on my metal directly but to use a container as an intermediate layer. I'm currently using docker as my virtualization layer with a preconfigured rocker image for that (more precisely the r-base image).

While this works in principle (I'm able to access the R CLI), I'm having an issue: I cannot easily to use my IDEs with that.

I don't want to install vim or Emacs in the container but run this from my machine directly. Using Emacs this means that I need to run an openssh-server in my container, connect via Tramp and then execute commands there as described here.

My question: is connecting via ssh actually needed when using Emacs+ESS as an IDE or is there a more elegant solution?

Addendum: x11 is often a problem. I found the following solution for running R directly and being able to plot (although I still need to try it):

## an alias for `docker run` that links the X11 device
alias docker-run-gui='XSOCK=/tmp/.X11-unix && XAUTH=/tmp/.docker.xauth && xauth nlist :0 | sed -e "s/^..../ffff/" | xauth -f $XAUTH nmerge - && docker run  -v $XSOCK:$XSOCK -v $XAUTH:$XAUTH -e XAUTHORITY=$XAUTH  -e DISPLAY=$DISPLAY'

## Use that alias in defining an alias that runs R from the hadleyverse container
alias R='docker-run-gui --rm -it -P --user 1000 -v $(pwd):/home/rstudio/`basename $PWD` -w /home/rstudio/`basename $PWD` rocker/hadleyverse R'

Alternatively, this (I assume from the same author) also looks interesting (if you don't want to use aliases).

From what I understand when using an IDE like Emacs+ESS (or maybe Nvim-R) that should also work. The approach described here didn't work for me (the R-function capabilities() showed X11 was still FALSE).

  • the current version of R is available for Debian stable and testing, if you add the backport repositories as described here: cran.r-project.org/bin/linux/debian/#supported-branches
    – Tyler
    Jul 17 at 12:07
  • @tyler: thanks for the link, that's helpful! But the issue I'm currently having is actually not with GNU R itself but with the R-package vitae which requires a more recent version of pandoc (actually: pandoc-citeproc). From what I understand I could sidestap all of those issues by using a container with a more recent version of Debian (or Alpine or whatever).
    – n0542344
    Jul 17 at 17:43
  • perhaps you could side-step the issue by installing the latest pandoc directly from source instead: pandoc.org/installing.html#linux. I haven't used containers before, but what you're describing sounds a lot more complicated that installing a few programs from source
    – Tyler
    Jul 17 at 21:46
  • @Tyler: in principle you are right, but I'd also need all the dependencies for this specific version of pandoc and that would lead to a mixture of packages from different Debian versions which does sound scary and is not recommended.
    – n0542344
    Jul 17 at 22:28
  • I'm suggesting you install Pandoc using the binary provided by Pandoc (see the link), not making a FrankenDebian. It sounds like the Pandoc binary is self-contained, and doesn't require any external dependencies (unless you choose to compile it yourself, which isn't necessary)
    – Tyler
    Jul 17 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.