Aquamacs in Mac OS X and Emacs in Linux/unix can be used to edit remote (and local) R code and submit pieces of code to a remote R session. For this to work you need to install ess for emacs (Aquamacs comes with ess by default now, I don't know about emacs). If you don't have ess, you can install following this recipe.
open an R script using emacs, you can open remote files using TRAMP. You need to do C-x C-f and enter the remote location as ". After you opened your remote R script, now you have to start a remote R session. First, we need to ssh to remote host from Emacs/Aquamacs using the following commands.
M-x ssh #after this you need to enter your username, remote host and you will be prompted your password
R #start R
M-x ess-remote #after starting R, you need to start and ess-remote session, so your R script and R session is connected. Now you can edit your remote script and also send code to your remote R session from your script. If you can't ssh from Emacs/Aquamacs you will need to install ssh.el.
First prepare a .emacs file, put it in your home folder. Also, make .emacs.d folder
your home directory. You will put the .el files in this directory.
------contents of .emacs file ----------- (setq load-path (cons "/home/username/.emacs.d" load-path)) (require 'tramp) (require 'ssh) (require 'password-cache) (setq password-cache-expiry nil) ------- end of .emacs file ----------------------- in .emacs.d directory, put the following files http://www.splode.com/~
friedman/software/emacs-lisp/ src/ssh.el or ftp://ftp.splode.com/pub/ users/friedman/emacs-lisp/ssh. el and this one you need so TRAMP doesn't ask password every time you save a file http://braeburn.aquamacs.org/ code/master/lisp/password- cache.el
With the recent versions of Aquamacs (Emacs on OS X) and possibly Emacs, I can do M-x shell, to get on to the shell and ssh to the remote server. Then, I use TRAMP via C-x C-f /firstname.lastname@example.org:/home/username/example.R to open the remote file in another tab. Then, finally use,M-x ess-remote. and everything works as expected. I can pass the code in the R file to R session.