Skip to content

please recommend an editor

20 messages · Hai Lin, Randall C Johnson [Contr.], Kasper Daniel Hansen +10 more

#
Hi Kevin,
I prefer Emacs with ESS. It is fairly easy to install, and includes syntax
highlighting and interfacing with R. The keyboard shortcuts are a little
awkward at first, but make life *much* easier in the long run. I've only
been using it for a few months, and I'm very happy with it.

Best,
Randy
On 12/5/05 5:07 PM, "Hai Lin" <kevinvol2002 at yahoo.com> wrote:

            
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Randall C Johnson
Bioinformatics Analyst
SAIC-Frederick, Inc (Contractor)
Laboratory of Genomic Diversity
NCI-Frederick
P.O. Box B
1050 Boyles Street
Bldg 560, Rm 11-85
Frederick, MD 21702
Phone: (301) 846-1304
Fax: (301) 846-1686
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
Kevin,
On Dec 5, 2005, at 5:07 PM, Hai Lin wrote:

            
Xcode is nice, but the R support is limited to some syntax  
highlighting (which was posted on this list some time ago).  
Personally I use either the integrated editor in the R GUI or Emacs  
(Carbon Emacs 22.0.50 to be more precise). Both have good R  
integration (i.e. not just syntax highlighting, but also auto- 
completion of functions, objects and argument lookup). The integrated  
R GUI editor is more suitable for beginners, Emacs is ... well,  
Emacs :) powerful if you know how to use it (and it's the only one  
with Rd mode AFAIK). I have also heard that SubEthaEdit is a really  
good editor with R syntax highlighting support, but never used it  
myself.

Cheers,
Simon
#
One nice feature of the R GUI integrated editor is the ability to run an R command from within the editor.  It also looks and feels like the App itself, which is nice.

I have found that Emacs does a better job with auto-indentation, and have also made use of Emac's backup automation features.  Emacs can probably do the "run a command from the editor trick" (it unclogged my toilet the other day); I just haven't figured out how to make it happen yet.
On Tuesday, December 06, 2005, at 09:10AM, Simon Urbanek <simon.urbanek at r-project.org> wrote:

            
#
As several people have replied, Emacs is by far the preferred choice  
for most serious R developers. Using the ESS package with Emacs  
provides you with an interface to R which goes beyond just syntax  
highlightning. An example (which Simon has already described): you  
can press a key combination to start looking up in the help system.  
Typing plot. and pressing TAB will then give you alist of help pages  
for functions starting with plot. amongst the loaded packages. This  
is extremely useful. There are other features such as the ability to  
send a single line of code or a single function to R (instead of  
sourcing the whole script). For package writes there are also nice  
modes for .Rd files and (in case you use it) saved transcript files  
(you can eg. say you entire transcript from an R session and remove  
all the output, leaving only the commands as a sourcable R script.).  
Ess supports Sweave documents as well.

Emacs has other advantages:
* it is truly cross-platform, a big advantage if you are also using  
*NIX servers and/or windows
* it supports basically any kind of language out there, so if you  
write in a set of different language, it makes sense to use a single  
editor
* One small lifesaver for statisticians (and others): it supports  
rectangular cut and paste: imagine being able to cut out a column  
from a table...

Other editors does the same, but the functionality of the ESS package  
is to my knowledge not present in any other editor, making Emacs a  
first choice for R users.

Having said all of that, Emacs is a big program (which btw. is older  
than dos), with some learning curve. It will take you a long time  
before you feel totally at home in it. And you will spend the first  
couple of months cursing about the strange key combinations and the  
small quirks. So do not even think of using it unless you plan to do  
more than write 10 lines of R code.

As Jan has said: you do not in any way need to run X11 to run Emacs,  
although it makes sense to use x11 to plot graphics.

Other people have suggested other editors for the causal user.

/Kasper
On Dec 5, 2005, at 2:07 PM, Hai Lin wrote:

            
#
This is a related remark to this topic and the icon topic of last week.
I'm not sure how file associations work between OS X apps and their 
extensions, however R.app doesn't appear to "own" any file extensions 
when it is installed, and they have generic or blank icons. Perhaps the 
individual keen on making icons from the email discussion last week 
could make new icons for "*.R" files, which might look like R-code with 
the R logo; an icon for "*.RData" which could look like those DB 
cylinders with the R logo; and another icon for "*.Rd" files 
(document-like text with the R logo?).
I forget if I had to manually get the "*.RData" extension to "Open 
with..." R.app, but this should be an automatic association after 
install; same goes for the "*.R" files.
The default behavior for double-clicking an "*.R" file should not open 
XCode, and should not be associated with an XCode "*.r" Resource Manager 
file icon. (I'm defiantly not sure if app file ownership in OS X is case 
sensitive, because in an ideal UNIX world "*.r" extensions and "*.R" are 
different, which they are in this case.)
Anyways, just a thought.
+mt
Simon Urbanek wrote:
#
Appreciate you all for kind replys. With others, I am
getting incrediable amount of Info. It really really
helps.

Thanks again.

Kevin

--- Kasper Daniel Hansen <khansen at stat.Berkeley.EDU>
wrote:
#
ctr-c ctr-j  runs the line
ctr-c ctr-r  runs the region - mark the beginning of the region with ctr-spc
ctr-c ctr-b  runs the buffer

Best,
Randy

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Randall C Johnson
Bioinformatics Analyst
SAIC-Frederick, Inc (Contractor)
Laboratory of Genomic Diversity
NCI-Frederick
P.O. Box B
1050 Boyles Street
Bldg 560, Rm 11-85
Frederick, MD 21702
Phone: (301) 846-1304
Fax: (301) 846-1686
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
Furthermore, if I ever got around to doing anything else with the  
Xcode stuff, it would be aimed towards the package developer and not  
the R user. In my copious spare time, of course.
On Dec 6, 2005, at 8:08 AM, Simon Urbanek wrote:

            
---
Byron Ellis (ellis at stat.harvard.edu)
"Oook" -- The Librarian
#
This is a really important feature but BBEdit and Alpha also
support it (option-click-drag)
On Dec 6, 2005, at 12:29 , Kasper Daniel Hansen wrote:

            
#
since this topic is pretty popular, let me mention a problem i have  
found with the integrated editor from R.app:

the "undo typing" command seems to remove an arbitrary number of  
keystrokes.  at times, i will make a mistake, then when i go to undo  
it, i find the editor has undone not only my mistake but a  
significant amount of prior work.  it is difficult to produce a  
replicable example, because i am not sure whether the number of  
keystrokes that are undone is a function of time between the  
keystrokes, or some other grouping mechanism.   i apologize for not  
including one.

just wondering, has anyone else experienced this?  is it a bug, or a  
setting?
On Dec 6, 2005, at 12:02 PM, Randall C. Johnson [Contr] wrote:

            
3 days later
#
On Dec 7, 2005, at 8:06 AM, Jan de Leeuw wrote:

            
Good to know - we could build it into the integrated Mac GUI editor  
as well - any other wishes? The Xmas shall be jolly, so I could put  
in a feature or two ;) ..

Cheers,
Simon
#
On Dec 8, 2005, at 5:21 AM, Parlamis Franklin wrote:

            
The problem is to decide when to put in a checkpoint. Right now, we  
are forcing them only after <Enter> which is ok for usual work, but  
if you are only fixing a line here or there then those won't be  
checked in. Should we use some time-based limit? Cocoa's default is  
to place no checkpoints so it's not a help :P

Cheers,
Simon
#
Since you mentioned christmas - ideal might be a short time limit (10 
s?) and multiple undos. Knowing how the checkpoint is set already 
helps a great deal.

Cheers,
	Martin
#
i think time-based might be awkward because if you don't type for a while, your first several (potentially many) strokes of the undo command would have no effect.  maybe a certain number of keystrokes?  whatever aquamacs does works fine by me, so i would mimic if possible.
On Monday, December 12, 2005, at 01:50AM, Martin Renner <martin.renner at stonebow.otago.ac.nz> wrote:

            
17 days later
#
Use the application diff from the shell

  diff -c file1.R file2.R

 D.
Hai Lin wrote:

  
    
#
On 12/30/05 3:29 AM, "Duncan Temple Lang" <duncan at wald.ucdavis.edu> wrote:

            
Emacs has a diff built in.

Sean
#
On 29 Dec 2005, kevinvol2002 at yahoo.com wrote:
Since you are using Emacs already, you might try M-x ediff.  But
before you do that, you can read the help for it via C-h f ediff.

+ seth
#
Kevin,
On Dec 29, 2005, at 3:45 PM, Hai Lin wrote:

            
just for completeness, there is a very nice utility in Developer/ 
Applications/Utilities called "FileMerge". It is much nicer than diff  
and also allows you to create a resulting file by specifying which  
parts you want from which file. It is too intuitive and easy to use  
for Emacs users but I though I'll mention it anyway ;).

Cheers,
Simon