Is there an rmate equivalent command for opening files from a server in your laptop's RStudio?

rstudio

#1

Hi,

For my work, I am frequently logged in via ssh to a high performance computing cluster and frequently edit files (including .R and .Rmd) there. I have grown used to editing the files with the TextMate editor using the rmate utility (http://github.com/textmate/rmate). So my recurrent use case is:

  • open terminal
  • ssh cluster
  • rmate file.R
  • edit file with my fav text editor
  • save the file (automatically it’s saved in the cluster).

I tested that this same workflow can be done using Cyberduck in a Mac and WinSCP in a Windows machine using the “edit with” functionality and choosing RStudio. But I haven’t found a way to do this with a command utility, which would make the process more robust. Right now if I close Cyberduck or it crashes, then I’m in trouble.

Is there such a command that I can type in the terminal to open a file with RStudio in my laptop? Looks like it should be doable given that WinSCP and Cyberduck work.

I asked in an internal Slack and via https://twitter.com/fellgernon/status/964542934950531072 but didn’t get an answer. Also, I looked through github. com/rstudio/rstudio/issues and the community website and didn’t find information about this. But if it’s there, please let me know!

With the introduction of the RStudio terminal (support.rstudio .com/hc/en-us/articles/115010737148-Using-the-RStudio-Terminal) it makes sense to me to switch from TextMate to RStudio, mainly because now it’s possible to “send to terminal” for evaluating code in the text file (.R, .Rmd, etc). Plus RStudio has many R related features that TextMate doesn’t have.

Some notes:

  • When you configure rmate you have to choose a port and enable some port forwarding in your ~/.ssh/config file. Maybe the equivalent command for RStudio will need to do something similar.
  • rmate can be used with Sublime Text as well github .com/henrikpersson/rsub. Several colleagues use this.
  • Why not run RStudio in the cluster itself? Because it’s super slow via X11 forwarding. Plus it’s not as easy to keep it updated.
  • Why don’t edit files in the cluster with vi/emacs? Because I like TextMate (or Sublime) more than those for long R-centric files. And the whole point is that I’m considering switching to RStudio.

Thank you!
Leonardo


#2

Unfortunately, to the best of my knowledge this isn’t currently possible.

Would it be feasible to mount the files you want to edit locally? E.g. via sshfs (https://wiki.archlinux.org/index.php/SSHFS), or some other solution for mounting networked drives locally?


#3

Hi Kevin,

Thanks for the reply! Indeed Pablo Cordero https://twitter.com/tsuname/status/964701926691520512 also mentioned sshfs which does work for the question I asked. Thank you both!

I do however find sshfs to be slower for browsing directories than Cyberduck/WinSCP, so I’ll keep using those for now. I might give sshfs another try.

Best,
Leonardo

PS If RStudio ever makes this a feature, please let me know! I now realize that it’s probably low priority given that 2 different solutions exist.