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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
In-Reply-To: <3.0.32.20010303215033.008fce80 at 162.38.183.200> Emmanuel, Although, this will be obvious to many, what are the advantages of running R in Emacs. As a windows, just learning Linux user, I have never used Emacs so i would be grateful for a run down on its benifits. Many thanks, Graham S -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
In-Reply-To: <Pine.GSO.4.31.0103041827280.4732-100000 at toucan.stats> Brian, Thanks for your response, as I am beginning to use Linux as well as Windows I did think about Emacs as providing a common interface. Based on what you say, I should maybe rethink that. I will certainly download the more recent versions. Cheers, Graham S -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
In-Reply-To: <Pine.LNX.4.21.0103041539160.459-100000 at Chrestomanci.home.earth> Faheem,> Hi. The way I use it is, I open one buffer with the R code I am writing. > in another window I run R. I can load the R code into R using C-c C-l, > which is quicker and more convenient than source(" "), and I can viewThanks for this, I am beginning to understand why it is useful. Cheers, Graham S -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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).> +----------------------------------+ > | 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*********** It was line 251 in the file I got (in ESS-5.1.18) ***********> 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*********** 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 -- Dr Renaud Lancelot, v?t?rinaire CIRAD, D?partement Elevage et M?decine V?t?rinaire (CIRAD-Emvt) Programme Productions Animales http://www.cirad.fr/presentation/programmes/prod-ani.shtml ISRA-LNERV tel (221) 832 49 02 BP 2057 Dakar-Hann fax (221) 821 18 79 (CIRAD) Senegal e-mail renaud.lancelot at cirad.fr -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thanks to all the replies I got on my initial posting. I am summarizing everything, and will send updated instructions/advice to the list when finished. Emmanuel -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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, Mar 05, 2001 at 10:17:43AM +0100, Emmanuel Paradis wrote:> Thanks to all the replies I got on my initial posting. I am summarizing > everything, and will send updated instructions/advice to the list when > finished. >Another advantage of ESS (not mentioned in this thread, if I read all of it) is function and object names completion (I am really addict to the TAB key and tend to use it everywhere also when it is not supported). This is a feature which can be considered also for Rgui and Unix-readline based version of R but it is not there now. guido -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 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".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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Dear All, Thanks again to those who helped me to improve what is below. About the advantages of using ESS, I do not repeat here the opinions that have been sent recently on r-help (see particularly the messages by Prof Brian Ripley, Rich Heiberger, Peter Dalgaard, Faheem Mitha, Renaud Lancelot, Guido Masarotto; they should be in the list archive under the subject: Re: [R] Emacs & ESS under Windows). See also the R-FAQ. If I have still missed something, do not hesitate to tell me. Emmanuel Paradis ---------------------------------------- Short guide to install ESS under Windows ---------------------------------------- The following summary is for a Windows system (mainly NT, but this applies to 95/98 too) which has none of Emacs, gnuserv, or ESS installed. Sections 1 and 2 are about getting and installing Emacs, sections 3-6 are about getting and installing ESS, section 7 is about getting and installing gnuserv, and section 8 gives a few hints on how to start with ESS. It is assumed that all packages are or will be installed in D:\ (if you choose another location, change accordingly). It is preferable to install these packages (including R) in locations independent of each others, so that they can be updated easily. 1. Download a precompiled copy of Emacs v. 20.7 for Windows on Intel machines: ftp://ftp.gnu.org/gnu/windows/emacs/20.7/emacs-20.7-fullbin-i386.tar.gz This is a 13 Mb file that includes precompiled binaries of Emacs, and lisp source (useful for understanding how packages work, and how they can best be setup or customized). 2. Unpack the downloaded file in a directory, e.g., "D:\", then execute the file "D:\emacs-20.7\addpm.exe". Emacs is then installed on your Windows machine, and a shortcut should have been added to your Start menu. Installing Emacs may not be so straightforward depending on the setup of your system. For instance, it may be better to turn off virus checkers (Norton Anti-Virus 2001 breaks this, for example; McAfee virus scanner seems to interact badly with Emacs too). There is a very detailed FAQ for Emacs on Windows at: http://www.gnu.org/software/emacs/windows/ntemacs.html Section 3 of this FAQ details the installation process of Emacs under Windows. There are also lots of useful informations on how to customize Emacs. It is also recommended to change the default starting directory for Emacs to you own personal directory to help protect you from accidentally changing files in the Emacs directory. Do so by right-clicking on the Emacs short-cut, go to the "Shortcut" tab, and then change the value in "Start in:". 3. Download ESS v. 5.1.18 at: http://ess.stat.wisc.edu/pub/ESS/ESS-5.1.18.tar.gz It is a 558 Kb file. 4. Unpack the downloaded file in its own directory, e.g. "D:\" (of course, keeping the tree structure of the zip archive). Avoid unpacking this archive in the Emacs (sub)-directory(ies) so that you can upgrade Emacs and ESS independently in the future. 5. Edit the file "D:\ess-5.1.18\lisp\ess-site.el". In this file, the semicolons indicate comments. Find the line #250 (easy with Emacs...) which is like this: ;;(setq-default inferior-R-program-name "Rterm") ; msdos systems This line tells ESS where to find the R executable. Thus, uncomment the line, and write in place of "Rterm" where is your Rterm.exe, for instance, is you installed R v. 1.2.2 for Windows in D:\, the line becomes: (setq-default inferior-R-program-name "D:/rw1022/bin/Rterm") ; msdos systems Of course, you may delete the string "; msdos systems". If you installed R in C:\Program Files, then the line must be: (setq-default inferior-R-program-name "C:/Progra~1/rw1022/bin/Rterm") taking care to use the DOS name of the directory. Note that you may use "Rgui" instead of "Rterm", but R's outputs will be displayed in the Rgui console rather than within Emacs (as is the case with Rterm). 6. Edit or create a file called ".emacs" (or "_emacs"). You can read some infos on "What is a .emacs file?" at: http://www.gnu.org/software/emacs/windows/faq3.html#what-startup When Emacs is started, it looks for the .emacs file in your HOME directory. HOME is an environment variable which can be set in several ways. Under Windows NT, open the Control Panel, go to the System panel, and click the "Environment" tab, then add (or modify) the appropriate environment variable. (This procedure gives the possibility to set HOME on a per-user basis.) Under Windows 95, you can set the HOME environment variable in your autoexec.bat file (you will need to reboot). If no HOME has been set, Emacs will look for .emacs in C:\. Once HOME has been set, add in .emacs the following line: (load-file "d:/ess-5.1.18/lisp/ess-site.el") 7. ESS is now configured to run with R and Emacs, but it is very useful to install gnuserv, a small program that allows file associations with Emacs (thus loading files into an already running Emacs, or if none, one is launched). More information are at: http://www.gnu.org/software/emacs/windows/faq3.html#assoc where there is also a link to download gnuserv, or: http://www.gnu.org/software/emacs/windows/ntemacs/contrib/gnuserv-2.1p1.zip Unpack the dowloaded file, e.g. in D:\, and add in .emacs the following three lines: (load-file "d:/gnuserv/gnuserv.el") (require 'gnuserv) (gnuserv-start) You also need to have the gnuserv executables and runemacs.exe in your path (under Windows NT, this is done by editing the PATH environment variable in the System panel of the Control Panel), in our example, one needs to add "D:\emacs-20.7\bin;D:\gnuserv;" to this environment variable. Now, open Explorer, select "options" in the menu "view", select the "file types" tab, click on "New type...", fill the fields (specifying, of course, the .R extension), and under "actions", click "New...", a new window is then open. Under "action" type "open", and in the second field type D:\gnuserv\gnuclientw.exe "%1" where the "%1" allows filenames with blanks in them to bee treated as one argument when sent to Emacs. Close all windows by clicking "Ok". 8. When you open a *.R file, this opens Emacs and ESS. To run R under Emacs, type Alt-x R (M-x R in Emacs' terminology), and then Enter (this will open a DOS-like window, so you have to come back to Emacs). Within 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" (or by typing Ctrl-c Alt-b, ... I mean C-c M-b). EP 6-3-2001 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
This is a nice desription. There are a few small changes I would like to see. The DOS window you get when starting R shouldn't be there. I haven't Yet figured out why it is there for you. The only thing I see that should be changed may not actually address this issue: Your are referencing the "Emacs" shortcut. Don't use it. It is better to use the "Runemacs" shortcut. Reason: runemacs avoids the DOS box when starting emacs. I copy the runemacs shortcut to my Desktop and to my startup. That way emacs is always running and I don't have to do anything but turn the machine on. The addpm.exe is no longer needed. addpm does things to the Windows registry. The advantage of not needing it is that you can copy the entire d:\emacs-20.7\ directory tree to a ZIP drive or a CD and run them on another machine without touching the registry on the other machine. This allows you to run on machines to which you don't have write permission for the registry. Rich -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Emmanuel -- Thank you very much for your posting on setting up Emacs and ESS under Windows. I had already set these up at work, but I used your instructions at home and they were very helpful. One thing that was not included in your instructions that might help: I found that I needed to add the path to the rterm.exe file to my autoexec.bat file. In other words, if your path statement in your autoexec.bat file is : path=c:\windows; you may need to change it to: path=c:\windows;c:\rw1022\bin; In fact, I think the official Emacs instructions tell you to add c:\emacs-20.7\bin; to the path statement as well, which I did to my work machine but not to my home machine, with no apparent difference in function. Note that if you don't add c:\rw1022\bin to your path statement, you get a message saying: "Searching for program, no such file or directory, Rterm." -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
It may be worth noting that, after installing a new version of R, it pays to change the name of the directory from e.g. rw1022 to r, or to some other name that will not change. (The existing directory might first be renamed to r.old . For one thing, one will probably want to copy across those libraries that are compatible with the new version.) This avoids having to change the target fields in one's various icons and anywhere else where it is needed, such as in David's path statement below.> From: david.beede at mail.doc.gov > Subject: Re: Emacs & ESS under Windows > To: Emmanuel Paradis <paradis at isem.univ-montp2.fr> > Cc: r-help at stat.math.ethz.ch, ESS-help at stat.math.ethz.ch > Date: Mon, 19 Mar 2001 11:38:41 -0500 > > Emmanuel --> Thank you very much for your posting on setting up Emacs and ESS > under Windows. I had already set these up at work, but I used your > instructions at home and they were very helpful.> One thing that was not included in your instructions that might > help: I found that I needed to add the path to the rterm.exe file to > my autoexec.bat file. In other words, if your path statement in > your autoexec.bat file is :> path=c:\windows; > > you may need to change it to: > > path=c:\windows;c:\rw1022\bin;> In fact, I think the official Emacs instructions tell you to add > c:\emacs-20.7\bin; to the path statement as well, which I did to my > work machine but not to my home machine, with no apparent difference > in function. Note that if you don't add c:\rw1022\bin to your path > statement, you get a message saying: > "Searching for program, no such file or directory, Rterm." > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-John Maindonald email : john.maindonald at anu.edu.au Statistical Consulting Unit, phone : (6125)3998 c/o CMA, SMS, fax : (6125)5549 John Dedman Mathematical Sciences Building Australian National University Canberra ACT 0200 Australia -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._