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
).