Skip to content

Emacs & ESS under Windows

4 messages · Emmanuel Paradis, Renaud Lancelot, Dr. Marc R. Feldesman +1 more

#
After the discussions about appropriate editors under Windows to use with
R, I have managed to install Emacs, XEmacs, and ESS under WinNT 4.0, and
these work fine. It's not necessary to compile anything to use R with ESS,
just to install Emacs and ESS, and do a few modifications in some files.
XEmacs is also easy to install but apparently ESS cannot run with it
(confirmed by a message by Tony Rossini).

A point is probably that most people who start with R are a bit
disoriented, thus telling them to learn also Emacs and ESS is a bit too
much at once. To try to remedy this, I have summarized the steps to install
Emacs and ESS. I have indicated the versions I used, but did not try
others. I welcome comments and suggestions on this(I shall probably include
this in my doc "R for beginners").

(I have found the setup I describe below to not have all the
functionnalities of XEmacs + ESS under Solaris. Is that because I did not
compile the ESS files?)


Emmanuel Paradis


+----------------------------------+
| How to install ESS under Windows |
+----------------------------------+
1. Download a precompiled copy of Emacs v. 20.4 for Windows on Intel machines:

	ftp://ftp.gnu.org/gnu/windows/emacs/20.4/emacs-20.4-bin-i386.tar.gz

2. Unpack the downloaded file in a directory, e.g., "D:\", then execute the
file "D:\emacs-20.4\addpm.exe". Emacs is then installed on your Windows
machine, and a shortcut should have been added to your start menu.

3. Download ESS v. 5.1.8 at:

	http://ess.stat.wisc.edu/pub/ESS/ESS-5.1.8.zip

4. Unpack the downloaded file in "D:\emacs-20.4\lisp\" (of course, keeping
the tree structure of the zip archive).

5. Edit the file "D:\emacs-20.4\lisp\ess-5.1.8\lips\ess-site.el", and
modify the line #144 to this:

(setq-default inferior-R-program-name "D:/rw1021/bin/Rterm.exe")  ; msdos
systems

This is if you installed R for Windows in D:\; if you installed it, for
instance, in C:\Program Files, then this line must be:

(setq-default inferior-R-program-name "C:/Program
Files/rw1021/bin/Rterm.exe")  ; msdos systems

(The semicolons in this file indicate comments.)

6. Add a file called "_emacs" in C:\ with the following line in it:

(load-file "d:/emacs-20.4/lisp/ess-5.1.8/lisp/ess-site.el")

7. ESS is now configured to run with R and Emacs, but it is very handy to
create a type for *.R files that opens Emacs directly. To do this, open
Explorer.exe, then open "options" in the menu "display", select the thumb
"types of files", click on "New type...", file the fields, and under
"actions", click "New...", a new window is then open. Under "action" type
"open", and the second field type D:\emacs-20.4\bin\emacs.exe. Close all
windows by clicking "Ok".

[Note: this is approximately translated from my French WinNT menus]

Now, when you open a *.R file, this opens directly Emacs and ESS. To run R
under Emacs, type Alt-x R, and then Enter (this will open a DOS-like
window, so you have to come back to Emacs). You switch between the
different files, buffers, processes, ... with the menu "Buffers". When you
edit a *.R file you can evaluate the R expressions with the "ESS" menu by
selecting "eval buffer".


EP
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
1 day later
#
Hi Emmanuel,

I use S+ and R under MSWin98 and I found your message very useful
because I spent most of my time in the week-end to try to find out how
to get emacs / ess / R work together ! Thanks to you, it works ! Prof
Ripley already suggested to use more recent versions of emacs & ess. See
2 further remarks below (signalized by "******").

As a (very) new user of emacs / ess, I like it because it is much more
convenient (IMHO) than to source R code from a file, or to edit / copy /
paste in the command window. It offers the same comfort than the script
window in S+ / MSWin, with further advantages of nice in-line debugging
facilities as indicated by Pr Ripley (typos).
***********

It was line 251 in the file I got (in ESS-5.1.18)

***********
***********

In the Ess readme file, it is indicated that an "old-style" msdos name
should be given, i.e.
"C:/Progra~1/rw1021/bin/Rterm.exe"

instead of:

"C:/Program files/rw1021/bin/Rterm.exe"

***********


Thanks again,

Renaud
#
With the changes to the files, I was able to get this 
combination to work beautifully under Windows 2000.  I'm 
an utter novice with Emacs & ESS, but figured that since I 
wanted some "scripting" capabilities for R like those built 
into S-Plus 2000 (& 6.0 & earlier version SP4+), this might 
be one way to accomplish it.

Couple of questions:

1.  I've been working in the rgui and have a data directory 
defined for each project I'm working on.  It there a 
straightforward way to link the existing project directories 
(and the .Rdata files) with instances of emacs+ESS  or 
does this have to be done manually each time?   I don't 
want to reinvent the wheel.  I know that I can use:

 M-x ess-create-object-name-db

which seems to "import" the .RData file into the emacs\bin 
directory.  I'd like to keep the .RData file in its own project 
directory along with source code, text files, and various 
types of output files.  I'd also like to make certain the 
updates to data, code, etc stay in that project directory.  I 
didn't see any "quick and dirty" explanation for how to do 
this.  

2.  I noticed that under Emacs+ESS + R I am unable to 
tile the graphics window of R with the buffer window of 
Emacs.  Is there an Emacs (or ESS) sequence that 
forces the child windows to tile?

Thanks for your help.




********************************
 Dr.  Marc R. Feldesman                         
 Professor and Chairman, Anthropology Department
 Portland State University                      
 e-mail:  feldesmanm at pdx.edu 
 http://odin.pdx.edu/~h1mf                   
 fax: (503)-725-3905                            
 voice: (503)-725-3081                            
              
                           
"Don't where I'm goin'
Don't like where I've been
There may be no exit
But hell, I'm goin' in"                       

Powered by Macrochoerus

****************************
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Mon, 5 Mar 2001, Dr. Marc R. Feldesman wrote:

            
No, AFAIK.  It's not a child window. It is a separate window from a
separate Rterm process. This is like running RGui --sdi, not --mdi.