~ubuntu-branches/ubuntu/edgy/ess/edgy

« back to all changes in this revision

Viewing changes to doc/ess-intro-graphs.tex

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-11-11 00:51:43 UTC
  • mfrom: (1.1.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20041111005143-wv1cih1h04xyrxrb
Tags: 5.2.3-3
* repair broken replace-regexp-in-string -> ess-replace-regexp-in-string
  patch
* expand autoload functionality in emacsen-startup

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
\documentclass{article}
 
2
 
 
3
\newif\ifMM\MMtrue
 
4
\MMfalse
 
5
\newif\ifdraft
 
6
% During writing: a draft:
 
7
%\drafttrue
 
8
% FINAL:
 
9
\draftfalse \ifMM\drafttrue\fi
 
10
 
 
11
\ifdraft  %% generate tableofcontents down to the \paragraph
 
12
\setcounter{tocdepth}{5}
 
13
\fi
 
14
%1. introduction
 
15
%        a) a statistician's needs
 
16
%        b) statistical analysis packages supported by ESS
 
17
%2. emacs
 
18
%        a) buffers
 
19
%        b) key sequences
 
20
%        c) modes
 
21
%                1) font-lock
 
22
%                2) shell/comint
 
23
%                3) ange-ftp/EFS/tramp
 
24
%                4) vc/pcl-cvs
 
25
%3. ESS
 
26
%        a) interactive
 
27
%           1) S family
 
28
%           2) SAS
 
29
%        b) batch
 
30
%           1) SAS
 
31
%           2) BUGS
 
32
%           3) S family
 
33
%4. ESS as an open-source project
 
34
%        a) origins
 
35
%                1)S-mode
 
36
%                2)SAS-mode
 
37
%        b) unification
 
38
%                1)ESS-mode
 
39
%                2)Emacs/XEmacs
 
40
%                3)Unix/Windows/Mac
 
41
%5. conclusion
 
42
%        a) summary
 
43
%        b) what's next for ESS
 
44
%   ESS internet resources
 
45
%        a) home page
 
46
%        b) ess-help
 
47
%        c) anonymous cvs
 
48
%   References
 
49
%
 
50
\ifdraft
 
51
 \addtolength{\topmargin}{-1cm}
 
52
 \addtolength{\textheight}{+1cm}
 
53
\else%FINAL:
 
54
 \renewcommand{\baselinestretch}{1.5}
 
55
\fi
 
56
\addtolength{\oddsidemargin}{-0.5in}
 
57
\addtolength{\textheight}{0.2in}
 
58
\addtolength{\textwidth}{1in}
 
59
\ifMM\addtolength{\textheight}{2cm}\fi
 
60
 
 
61
%%%
 
62
\usepackage[authoryear,round]{natbib}
 
63
%or (if you have an unshiny latex installation)
 
64
%\newcommand{\citep}[1]{{\{\sf#1\}}}
 
65
%%%
 
66
\usepackage{alltt}
 
67
 
 
68
%% Postscript fonts
 
69
\usepackage{times}
 
70
\usepackage{graphicx}
 
71
%\DeclareGraphicsExtensions{.jpg,.pdf,.png,.mps,.ps}
 
72
\DeclareGraphicsRule{.ps}{eps}{.ps.bb}{}
 
73
\DeclareGraphicsRule{.ps.Z}{eps}{.ps.bb}{'/bin/zcat -c #1}
 
74
%\graphicspath{{jcgs/}}
 
75
%\usepackage{psfig}
 
76
 
 
77
\ifx\pdfoutput\undefined
 
78
  %% Stuff wout hyperref
 
79
  \def\url#1{\stexttt{#1}} % To help fit in lines ?AJR: stextsf?
 
80
\else
 
81
  %% Stuff with hyperref
 
82
  \usepackage{hyperref}
 
83
  %%\hypersetup{backref,colorlinks=true,pagebackref=true,hyperindex=true}
 
84
  \hypersetup{backref,colorlinks=false,pagebackref=true,hyperindex=true}
 
85
\fi
 
86
%%---End of package requiring ---------- Own Definitions -------------
 
87
 
 
88
\newcommand*{\regstrd}{$^{\mbox{\scriptsize{\textregistered}}}$}
 
89
\newcommand*{\tm}{$^{\mbox{\scriptsize\sc tm}}$}
 
90
\newcommand*{\SAS}{\textsc{SAS}}
 
91
\newcommand*{\Splus}{\textsc{S-Plus}}
 
92
\newcommand*{\XLispStat}{\textsc{XLispStat}}
 
93
\newcommand*{\Stata}{\textsc{Stata}}
 
94
\newcommand*{\Rgui}{\textsc{Rgui}}
 
95
\newcommand*{\Perl}{\textsc{Perl}}
 
96
\newcommand*{\Fortran}{\textsc{Fortran}}
 
97
\newcommand*{\Scmt}[1]{\hbox{\qquad {\footnotesize \#\#} \textsl{#1}}}
 
98
\newtheorem{defn}{Definition}[section]
 
99
\newtheorem{ex}{Example}[section]
 
100
 
 
101
\newcommand{\stexttt}[1]{{\small\texttt{#1}}}
 
102
\newcommand{\ssf}[1]{{\small\sf{#1}}}
 
103
\newcommand{\elcode}[1]{\\{\stexttt{\hspace*{2em} #1}}\\}
 
104
\newcommand{\file}[1]{`\stexttt{#1}'}
 
105
\newcommand{\US}{{\char'137}}        % \tt _
 
106
\newcommand{\marpar}[1]{\marginpar{\raggedright#1}}
 
107
\newenvironment{Salltt}{\small\begin{alltt}}{\end{alltt}}
 
108
 
 
109
\newcommand{\emptyfig}{
 
110
\hspace*{42pt}\rule{324pt}{.25pt}\\
 
111
\hspace*{42pt}\rule{.25pt}{10pc}
 
112
\rule{316pt}{.25pt}
 
113
\rule{.25pt}{10pc}}
 
114
 
 
115
\newcommand{\ESSfig}[1]{\centering{#1}}
 
116
 
 
117
%% Use \begin{Comment} .. \end{Comment} for internal comments
 
118
\ifdraft
 
119
\newenvironment{Comment}{\begin{quote}\small\itshape }{\end{quote}}
 
120
%
 
121
\else  %% this requires
 
122
  \usepackage{verbatim}
 
123
  \let\Comment=\comment
 
124
  \let\endComment=\endcomment
 
125
\fi
 
126
 
 
127
 
 
128
%%--------------------------------------------------------------- Start Text
 
129
 
 
130
\title{Emacs Speaks Statistics (ESS): A multi-platform, multi-package
 
131
intelligent environment for statistical analysis}
 
132
 
 
133
%%For blinded submission:
 
134
%\author{anonymous}
 
135
 
 
136
%%For regular review:
 
137
\author{A.J. Rossini \and Richard M. Heiberger \and Rodney A. Sparapani
 
138
\and Martin M{\"a}chler \and Kurt Hornik \footnote{%
 
139
%%
 
140
    A.J. Rossini is Research Assistant Professor in the Department of
 
141
    Biostatistics, University of Washington and Joint Assistant Member at
 
142
    the Fred Hutchinson Cancer Research Center, Seattle, WA, USA
 
143
    \url{mailto: rossini@u.washington.edu};
 
144
%%
 
145
    Richard M. Heiberger is Professor in the Department of Statistics at
 
146
    Temple University, Philadelphia, PA, USA \url{mailto: rmh@temple.edu};
 
147
%%
 
148
    Rodney A. Sparapani is Senior Biostatistician in the Center for Patient
 
149
    Care and Outcomes Research at the Medical College of Wisconsin,
 
150
    Milwaukee, WI, USA \url{mailto: rsparapa@mcw.edu};
 
151
%%
 
152
    Martin M{\"a}chler is Senior Scientist and Lecturer in the Seminar for
 
153
    Statistics, ETH Zurich, Zurich, Switzerland
 
154
    \url{mailto: maechler@stat.math.ethz.ch};
 
155
%%
 
156
    Kurt Hornik is Professor in the Institut f{\"u}r Statistik,
 
157
    Wirtschaftsuniversit{\"a}t Wien and the Institut f{\"u}r
 
158
    Wahrscheinlichkeitstheorie und Statistik, Technische Universit{\"a}t
 
159
    Wien, Vienna, Austria \url{mailto: Kurt.Hornik@r-project.org}}}
 
160
 
 
161
%%\date{\today}
 
162
\date{$ $Date: 2003/10/22 17:34:04 $ $\tiny Revision: 1.255$ $}
 
163
 
 
164
\begin{document}
 
165
 
 
166
%% To cite everything
 
167
%%\nocite{*}
 
168
 
 
169
\ifdraft
 
170
\setcounter{page}{0}
 
171
%%\newpage
 
172
\tableofcontents
 
173
\fi
 
174
 
 
175
\maketitle
 
176
 
 
177
\ifdraft{}%% large line skip -- not for draft
 
178
\else%FINAL:
 
179
 \renewcommand{\baselinestretch}{1.5}
 
180
 %%- \baselineskip=2pc
 
181
\fi
 
182
 
 
183
\begin{abstract}
 
184
  Computer programming is an important component of statistics
 
185
  research and data analysis.  This skill is necessary for using
 
186
  sophisticated statistical packages as well as for writing custom
 
187
  software for data analysis.  Emacs Speaks Statistics (ESS) provides
 
188
  an intelligent and consistent interface between the user and
 
189
  software.  ESS interfaces with SAS, S-PLUS, R, and other statistics
 
190
  packages under the Unix, Microsoft Windows, and Apple Mac operating
 
191
  systems.  ESS extends the Emacs text editor and uses its many
 
192
  features to streamline the creation and use of statistical software.
 
193
  ESS understands the syntax for each data analysis language it works
 
194
  with and provides consistent display and editing features across
 
195
  packages.  ESS assists in the interactive or batch execution by the
 
196
  statistics packages of statements written in their languages.  Some
 
197
  statistics packages can be run as a subprocess of Emacs, allowing
 
198
  the user to work directly from the editor and thereby retain a
 
199
  consistent and constant look-and-feel.  We discuss how ESS works and
 
200
  how it increases statistical programming efficiency.
 
201
\end{abstract}
 
202
 
 
203
\noindent Keywords: Data Analysis, Programming,
 
204
S, \SAS, \Splus, R, \XLispStat, \Stata, BUGS, Open Source Software,
 
205
Cross-platform User Interface.
 
206
 
 
207
\section{Introduction}
 
208
\label{sec:introduction}
 
209
 
 
210
Most statistical research activities, particularly data analysis and
 
211
communication, involve some form of computing.  The computer user
 
212
interface is thus placed in the central role of facilitating
 
213
statistical tasks.  While presentation of character and graphical
 
214
information is the most visual component of a user interface,
 
215
perhaps a more critical component is how the computer interprets user
 
216
input.  A familiar, well-understood set of input behaviors can provide
 
217
large gains in efficiency.  This paper introduces Emacs Speaks
 
218
Statistics (ESS) \citep{ESS}, a software package which provides a
 
219
common interface to a variety of statistical packages on the most
 
220
common computing platforms.
 
221
 
 
222
ESS is an interface to statistical packages that provides tools which
 
223
facilitate both statistical software development and data analysis.
 
224
ESS provides assistance with both writing and evaluation of analysis
 
225
code for both interactive and batch statistical packages.  ESS
 
226
currently supports the S family of languages (including S
 
227
\citep{BecRCW88,ChaJH92,ChaJ98}, \Splus\regstrd\ \citep{Splus}, and R
 
228
\citep{ihak:gent:1996,R}; \SAS\regstrd\ \citep{SAS:8}; \Stata\
 
229
\citep{Stata:7.0}; \XLispStat\ \citep{Tier90} and its extensions Arc
 
230
\citep{Cook:Weisberg:1999} and ViSta \citep{youn:fald:mcfa:1992}; BUGS
 
231
\citep{BUGS}; and Omegahat \citep{DTLang:2000}.  ESS can be extended
 
232
to accommodate most statistical packages which provide either an
 
233
interactive command-line or process batch files for instructions.
 
234
 
 
235
We start by describing the Emacs text editor, the underlying platform
 
236
on which ESS is built.  Next, we discuss how ESS enhances a
 
237
statistician's daily activities by presenting its features and showing
 
238
how it facilitates statistical computing.  We conclude with a short history
 
239
of the development of ESS.
 
240
% and conclude with future extensions and related work.
 
241
 
 
242
\section{Emacs}
 
243
\label{sec:emacs}
 
244
 
 
245
Emacs is a mature, powerful, and extensible text editing system which
 
246
is freely available, under the GNU General Public License (GPL), for a
 
247
large number of platforms, including most Unix\regstrd
 
248
distributions, Microsoft Windows\regstrd\ and Apple Mac\tm\ OS.  There
 
249
are two open-source implementations of Emacs: GNU Emacs
 
250
\citep{GNU-Emacs} and XEmacs \citep{XEmacs}.  Emacs shares many
 
251
features with word processors, and some characteristics with operating
 
252
systems, including many facilities which go beyond ordinary text
 
253
editing.  More important to our goals, Emacs can control and interact
 
254
with other programs.
 
255
 
 
256
\paragraph{Keyboard and Mouse Input.}
 
257
When Emacs was originally written, character-based terminals were the
 
258
most advanced method of computer access.  Common Emacs commands were
 
259
mapped to key sequences, creating keyboard shortcuts for convenience.
 
260
Over the last decade, Emacs has been extended to use graphical
 
261
windowing systems, such as X11\tm, Microsoft Windows, and Apple Mac
 
262
OS, which allow additional forms of input, for example using a mouse,
 
263
and which encourage multiple applications to share a single display.
 
264
Presently, Emacs is more often used with a GUI, with commands bound to
 
265
mouse actions, but having commands also associated with key sequences
 
266
is an important ergonomic and time-saving feature.  Emacs menus and
 
267
toolbars on the display screen allow mouse access to frequently used
 
268
actions and provide a graphical alternative when the user does not
 
269
know or can not recall a key sequence; these are also subject to
 
270
user-customization.
 
271
 
 
272
\paragraph{Buffers give Emacs control.}
 
273
Emacs buffers are the interface between the user and computer.  They
 
274
can be considered to be a collection of scratch pads that both the
 
275
user and computer can read, write, and respond to.  The user can
 
276
simultaneously edit many files and control numerous programs by
 
277
opening multiple buffers.  With disk files, the working copy of the
 
278
opened file is placed in an Emacs buffer where it can be viewed and
 
279
edited either by the user or automatically by Emacs or another program
 
280
under the control of Emacs.  Emacs can save a backup of the contents
 
281
to disk at specified intervals.  Emacs presents buffer contents in
 
282
ways which optimize reading and navigation activities.  One example of
 
283
program control is the embedding of the interactive operating system
 
284
command line interpreter, called a shell, within Emacs.  Variations on
 
285
this theme are used to control programs such as statistical packages
 
286
which take input from and provide output to the command-line.  The
 
287
resulting buffers provide a copy of the entire transcript of the
 
288
interaction, which can be edited and searched while the program
 
289
executes.
 
290
 
 
291
\paragraph{Major and Minor Modes.}
 
292
Emacs capabilities are extended by loading
 
293
%% AJR: If we remove ``or byte-compiled'' we need to remove ``text'',
 
294
%% since it is wrong.
 
295
%% text
 
296
%% or byte-compiled
 
297
files containing commands and functions written in Emacs Lisp (elisp)
 
298
\citep{RChassell1999}, which is a dialect of Lisp
 
299
\citep{PGraham:1996}.  Emacs commands can be called interactively by
 
300
pressing a key sequence mapped to the command or by name.
 
301
%% AJR: this is actually true for M-x long-command-not-bound-to-keys,
 
302
%% but I'm not telling anyone this!
 
303
% Rodney: I don't understand what the problem is with telling them.
 
304
The most important extensions to Emacs take the form of modes, which
 
305
provide specific enhancements to the editing behavior.
 
306
 
 
307
Major modes provide a customized environment consisting of mapped key
 
308
sequences and associated commands for performing tasks such as file
 
309
editing, reading mail, or browsing disk directories.  Only one major
 
310
mode can be active for a given buffer at any time.  Major modes also
 
311
can be written to intelligently control other programs such as
 
312
statistics packages.  Major modes for file editing are often
 
313
determined by the file type or extension, i.e.  the characters at the
 
314
end of the file name that follow a period like \stexttt{txt},
 
315
\stexttt{s}, or \stexttt{sas}.  Examples of this kind of major mode are
 
316
\stexttt{ESS[S]} and \stexttt{ESS[SAS]}.  Major modes understand a
 
317
file's syntax and grammar and therefore provide intelligent
 
318
actions such as automatic indentation; navigation in units of
 
319
characters, words, lines, sentences, paragraphs, function definitions,
 
320
and pages; syntax-based fontification and colorization; and
 
321
reformatting based on programmed conventions.
 
322
 
 
323
Minor modes provide complementary services that that are applicable
 
324
across major modes.  Many minor modes can be active at once.  For
 
325
example, \stexttt{font-lock-mode} allows Emacs to highlight, with
 
326
fonts or colors, the syntax of a programming language whose
 
327
characteristics are described within a major mode like
 
328
\stexttt{ESS[S]}.  The \stexttt{overwrite-mode} determines whether
 
329
typed characters replace the existing text or are inserted at the
 
330
cursor.  Minor modes can emulate the key sequences used by another
 
331
editor such as \stexttt{vi}.  In addition, they can be used to perform
 
332
version control operations and many other operations which are nearly
 
333
identical across file types.
 
334
 
 
335
\paragraph{Network Support.}
 
336
Emacs allows transparent access to remote files over a network.  This
 
337
means that the user views, edits, and saves files on a remote machine
 
338
exactly as if they were on the local machine.  Mechanisms for both
 
339
open (\stexttt{ange-ftp} and \stexttt{EFS} use ftp) and secure
 
340
(\stexttt{tramp} uses scp or ssh) access are available.  Emacs can
 
341
also monitor and control remote processes running in a shell buffer.
 
342
 
 
343
\paragraph{Editing Extensions.}
 
344
Most programming and documentation tasks consist of editing text.
 
345
These tasks can be enhanced by contextual highlighting and recognition
 
346
of special reserved words appropriate to the programming language in
 
347
use.  In addition, Emacs also supports folding, outlining, tags, and
 
348
bookmarks, all of which assist with maneuvering around a file.  Emacs
 
349
shares many features with word processing programs and cooperates with
 
350
markup-language document preparation systems such as \LaTeX,
 
351
\textsc{html}, or \textsc{xml}.
 
352
 
 
353
Tracking changes to a text file made by multiple users, potentially in
 
354
different locations, is the job of source-code control programs.
 
355
Emacs interacts with standard source-code control programs such as CVS, RCS,
 
356
and SCCS through minor modes such as \stexttt{vc-mode}.  These
 
357
source-code control systems facilitate documenting and tracking edits and
 
358
changes to a file.  More importantly, they allow for branching and
 
359
merging of versions so that material present in an older version of
 
360
the file can be recovered and inserted into a newer version in a
 
361
fairly easy manner.
 
362
 
 
363
Comparison of files, two or three drafts of a paper for example, is
 
364
simplified by \stexttt{ediff}.  
 
365
An example is shown in Figure \ref{f.ediff}.  
 
366
The lines that are similar are highlighted in the two
 
367
buffers, one for each file, and the specific words that mismatch are
 
368
highlighted in a contrasting color.  \stexttt{ediff} has many tools
 
369
for working with the differences in files and in entire directories.
 
370
When combined with the patch utility or a source-code control system,
 
371
it provides the user with the ability to insert, delete or modify only
 
372
the differing portions of text files.
 
373
 
 
374
\begin{figure}[tbp]
 
375
  \ESSfig{\includegraphics[angle=270,width=\textwidth]{ediff-sas}}
 
376
%\url{http://software.biostat.washington.edu/ess/doc/figures/ediff-sas.gif}
 
377
  \caption{Ediff of two versions of a file.}
 
378
  \label{f.ediff}
 
379
\end{figure}
 
380
 
 
381
% Rodney: You can't just mention complex functionality like etags and
 
382
% speedbar.  We would need to introduce these packages.  Since they
 
383
% aren't critical to ESS at this time, let's ignore them.
 
384
Emacs has many other important features.  Emacs provides file-manager
 
385
capabilities, such as \stexttt{dired} (discussed in Major and Minor
 
386
Modes above) and \stexttt{speedbar}, both of which interface to the
 
387
computer's directory structure.  Emacs stores the complete history of
 
388
commands issued in an editing session, allowing a flexible and fairly
 
389
complete undo capability.  More importantly, for modes which control
 
390
processes, the process input history is stored for recall as well as
 
391
for later editing for printing or re-use.  Emacs also includes web
 
392
browsers, mail/newsgroup readers, and spell checking.
 
393
 
 
394
In addition to being an extremely powerful editor, Emacs also
 
395
includes capabilities usually found in an operating system.  Thus, it
 
396
provides a strong foundation for constructing an integrated
 
397
development environment focused on the needs of statisticians.  Emacs'
 
398
power, flexibility, portability, and extensibility make it a solid
 
399
platform on which to construct a statistical analysis user interface.
 
400
 
 
401
\section{ESS extends Emacs}
 
402
\label{sec:ess-extends-emacs}
 
403
 
 
404
Statistical programming is the writing of computer programs for data
 
405
analysis and processing.  These programs might be written in a
 
406
computer language that requires a compiler, such as \Fortran\ or C.
 
407
But, more likely, they are written in a statistical analysis language
 
408
that only requires an interpreter such as R, \SAS, \Stata, or \XLispStat.
 
409
General purpose languages such as \Fortran, C/C++, Java, and PERL
 
410
have integrated development environments which facilitate writing and
 
411
debugging code.
 
412
 
 
413
ESS extends Emacs to provide an integrated development environment for
 
414
statistical languages.  It offers a single
 
415
interface for a variety of statistical computing tasks including
 
416
interactive data analysis and statistical programming.
 
417
ESS is able to provide a functional and extensible interface
 
418
which is uniform and consistent across multiple statistical packages.
 
419
This is done by adding shortcuts and features for accelerated editing
 
420
of files as well as by interacting with the particular statistical
 
421
packages to provide, for example, control of input/output, assistance
 
422
with evaluation, and specialized parsing of help files.
 
423
 
 
424
ESS supports the S family (S, \Splus, and R) interactively.  \SAS\ and
 
425
BUGS are also well supported for batch processing.  \Stata\ and
 
426
\XLispStat\ (including ARC and ViSta) are supported through
 
427
highlighting and process-interfacing.
 
428
 
 
429
\subsection{Features and capabilities}
 
430
\label{sec:ESS:features}
 
431
 
 
432
\paragraph{Syntactic highlighting and indentation of source code.}
 
433
The programmers task is eased when language constructs (such as
 
434
reserved words, function calls, strings, and comments) are visually
 
435
identifiable and when lines of code are automatically indented to a
 
436
depth appropriate to their context (e.g., if--then clauses, loops).
 
437
ESS provides both of these to the programmer by including a
 
438
description of the syntax of each supported statistical language in
 
439
the form used by \stexttt{font-lock-mode}.
 
440
 
 
441
Figure \ref{f.font} shows an example of font-locking a complicated S
 
442
statement.  The top panel shows an \stexttt{if} statement with a long
 
443
expression in the condition and a multi-line consequence.  The keyword
 
444
\stexttt{if} is shown in purple, the string \stexttt{"deltat"} in
 
445
RosyBrown.  The comments are in red.  Everything else is in the
 
446
standard font.  The consequence is indented and the continuations of
 
447
the consequence are further indented.  The matching parentheses are
 
448
shown in green.  The cursor is indicated by a solid box.  In the
 
449
bottom panel, we replaced the matching parenthesis with an unbalanced
 
450
bracket.  Emacs immediately marks that with the paren-mismatch font,
 
451
bright purple in this example.  On a black and white terminal we would
 
452
use bold, underline, italic, and reverse-video, rather than colors, to
 
453
distinguish the fonts.
 
454
 
 
455
% Figure \ref{f.font} shows a black-and-white example of font-locking a
 
456
% complicated S statement.  The top panel shows an \stexttt{if}
 
457
% statement with a long expression in the condition and a multi-line
 
458
% consequence.  The keyword \stexttt{if} is shown in an underlined font,
 
459
% the string \stexttt{"deltat"} in an italic underlined font.  The
 
460
% comments are in an italic font.  Everything else is in the standard
 
461
% font.  The consequence is indented and the continuations of the
 
462
% consequence are further indented.  The matching parentheses are marked
 
463
% by a bold foreground and a shaded background.  The cursor is indicated
 
464
% by a solid box.  In the bottom panel we replaced the matching
 
465
% parenthesis with an unbalanced bracket.  Emacs immediately marks that
 
466
% with the paren-mismatch font, bright purple on
 
467
% a color terminal.
 
468
 
 
469
The font selection and the indentation depth are automatically
 
470
supplied by Emacs as the lines are typed.  The user has several
 
471
options for mapping of colors or fonts to each of the syntactic types.
 
472
We selected
 
473
% black-and-white font-mapping for display here.  On a color terminal
 
474
% we might use
 
475
purple for the keywords, red for comments, green for matching parens,
 
476
and inverse-video purple for mismatched parens.  Emacs makes default
 
477
choices of colors and ESS provides several other optional schemes.
 
478
 
 
479
\begin{figure}[tbp]%h
 
480
  \ESSfig{%
 
481
    \includegraphics[angle=270,width=\textwidth]{font-cor-s}
 
482
    \includegraphics[angle=270,width=\textwidth]{font-incor-s}%
 
483
    }
 
484
%\url{http://software.biostat.washington.edu/ess/doc/figures/font-cor-s.jpg}
 
485
%\url{http://software.biostat.washington.edu/ess/doc/figures/font-incor-s.jpg}
 
486
  \caption{We illustrate here with fonts and colors appropriate for a
 
487
    color display.  On a black and white terminal we would use bold,
 
488
    underline, italic, and reverse-video.  On a color terminal we
 
489
    would use a selection of colors.}
 
490
  \label{f.font}
 
491
\end{figure}
 
492
 
 
493
Since S syntax is similar to that of C, ESS uses the Emacs tools for
 
494
reformatting S code to match particular styles.  Common C format styles,
 
495
as well as locally customized styles, are defined by specifying the indentation
 
496
level for nested statements, location of open-braces (at the end or at the
 
497
beginning of a line), indentation offsets for if-then-else constructs,
 
498
and similar characteristics.
 
499
 
 
500
Syntax highlighting can be used to help enforce coding
 
501
standards.  Figure \ref{f.hilock} illustrates a standard for
 
502
\SAS\ programming that says all \stexttt{PROC} statements must use the
 
503
\stexttt{DATA=datasetname} option.
 
504
 
 
505
\begin{figure}[tbp]
 
506
  \ESSfig{\includegraphics[angle=270,width=\textwidth]{hilock-sas}}
 
507
%\url{http://software.biostat.washington.edu/ess/doc/figures/hilock-sas.gif}
 
508
  \caption{Enforce coding standards.  The standard here is
 
509
    that all \stexttt{PROC} statements must use the
 
510
    \stexttt{DATA=datasetname} option.  Lines that satisfy the
 
511
    standard turn green, lines that don't turn red.
 
512
    Ambiguous ones turn yellow.}
 
513
  \label{f.hilock}
 
514
\end{figure}
 
515
 
 
516
\paragraph{Process interaction.}
 
517
Emacs has historically referred to processes under its control as
 
518
``inferior'', accounting for the name inferior ESS (\stexttt{iESS}) to
 
519
denote the mode for interfacing with the statistical package.  Figure
 
520
\ref{f.ess-demo} shows the S language program \stexttt{ess-demo.s} in
 
521
the top buffer in \stexttt{ESS[S]} mode and the executing R process in
 
522
the bottom buffer \stexttt{*R*}.  The \stexttt{iESS} major mode of the
 
523
\stexttt{*R*} buffer is crafted for command-line editing.  This mode
 
524
remembers and uses the command history, allowing for the recall and
 
525
searching of previously entered commands.  Filename completion for
 
526
local directories is also available.
 
527
 
 
528
\begin{figure}[tb]
 
529
  \ESSfig{\includegraphics[angle=270,width=\textwidth]{ess-demo}}
 
530
%\url{http://software.biostat.washington.edu/ess/doc/figures/ess-demo.jpg}
 
531
  \caption{Line-by-line execution of a command file. The cursor is
 
532
    placed on a line in the \stexttt{ESS[S]} buffer and then with a single
 
533
    key sequence
 
534
    the line is sent to the \stexttt{*R*} buffer for
 
535
    execution.  The output of the package goes directly to the
 
536
    editable \stexttt{*R*} buffer.}
 
537
  \label{f.ess-demo}
 
538
\end{figure}
 
539
 
 
540
\paragraph{Source-level Debugging.}
 
541
ESS facilitates the editing of source code files, sets of commands
 
542
written for a statistical analysis package, and allows the user to
 
543
load and error-check small sections of source code into the package.
 
544
This is done through several mechanisms.  First, the presence of
 
545
unbalanced parentheses or mismatched/unterminated quotes is
 
546
immediately evident with syntactic highlighting of the source code.
 
547
Second, functions are provided for simple and consistent execution of
 
548
user-specified or natural units of the code (function definitions in S
 
549
or \XLispStat, \stexttt{PROC \dots\ RUN;} sections in \SAS).  An
 
550
error-free evaluation lets the user execute the next section of code;
 
551
if errors arise, the user edits the current unit and re-evaluates.
 
552
Once the code is verified, an entire buffer, or file, of code can be
 
553
sent to the package as a unit.  This file can also be used as a batch
 
554
file for routine analysis at a later time.  Finally, output from the
 
555
statistics package is normally captured directly by Emacs and placed
 
556
into a buffer from where it can be edited and searched.  Particular
 
557
forms of output such as requests for help pages and log-file output
 
558
can be diverted into special buffers with modes crafted to facilitate
 
559
reading.  These modes include tools for automatically placing the
 
560
cursor on the first \stexttt{ERROR}, for example in \SAS\ and S.
 
561
 
 
562
\paragraph{Interactive transcripts.}
 
563
A transcript records all commands entered by the analyst and the
 
564
corresponding text-based responses such as tables and comments
 
565
generated by the statistics package during an interactive statistical
 
566
analysis session.  Once a transcript file is generated, for example by
 
567
saving an \stexttt{iESS} buffer, \stexttt{transcript-mode} assists
 
568
with reuse of part or all of the entered commands.  ESS understands
 
569
the transcript's syntax, especially the potential prompt patterns used
 
570
during the interactive analysis.  ESS provides tools to facilitate
 
571
editing and re-evaluating the commands directly from the saved
 
572
transcript.  This is useful both for demonstration of techniques and
 
573
for reconstruction and auditing of data analyses.  Special ESS
 
574
functions can ``clean'' S language transcripts by isolating all input
 
575
lines and placing them in a new S language source file.  Transcript
 
576
cleaning facilitates the use of an exploratory interactive analysis
 
577
session to construct functions and batch files for routine analysis of
 
578
similar data sets.
 
579
 
 
580
\paragraph{Remote access to statistics packages.}
 
581
ESS provides transparent facilities for editing files and running
 
582
programs which might reside on numerous remote machines during the
 
583
same session.  The remote machine could be a different platform than
 
584
the local machine.
 
585
 
 
586
\paragraph{Manipulating and Editing Objects (S family).}
 
587
For languages in the S family, ESS provides object-name completion of
 
588
both user- and system-defined functions and data.  ESS can dump and
 
589
save objects (user- and system-generated) into formatted text files,
 
590
and reload them (possibly after editing).
 
591
 
 
592
\paragraph{Help File Editing (R).}
 
593
ESS provides an R documentation mode (\stexttt{Rd-mode}) which assists
 
594
in writing help files for R functions, objects, and other topics worth
 
595
documenting.  \stexttt{Rd-mode} provides the ability to view and
 
596
execute code embedded in the help file in the same manner as ESS
 
597
handles code from any S language source file.  It provides syntax
 
598
highlighting and the ability to submit code directly to a running ESS
 
599
process, either R or \Splus, for evaluation and debugging.  This
 
600
latter feature is useful for ensuring that code developed using R runs
 
601
under \Splus.
 
602
 
 
603
\paragraph{Cooperation across Multiple Tools.}
 
604
Statistical packages are intended for either general statistical
 
605
analyses or for specialized forms of statistical analyses.  The
 
606
specialized statistical packages can be far more efficient for their
 
607
intended activities, but this is balanced by their inability to
 
608
perform a wide range of general statistical functions.  Tightly
 
609
coupled inter-operability between general and specialized packages
 
610
rarely exists, but such a facility is often desired.  For example, a
 
611
general purpose package such as R does not perform Bayesian analyses
 
612
as easily as BUGS does.  On the other hand, BUGS lacks breadth in the
 
613
range of analyses and results it can generate.  For this reason, BUGS
 
614
is often distributed with R packages, like the diagnostic packages
 
615
CODA and BOA, which assist with importing and analyzing the results in
 
616
R.  Another point of contention is the difference in the interfaces
 
617
between general packages and specialized packages.  ESS helps by
 
618
providing a single point of contact to both tools, though the typical
 
619
interfaces (interactive for R, batch for BUGS) are different.
 
620
 
 
621
%\item[Rodney:]  I can't speak for everyone, but the BUGS users I know are
 
622
% .. lots deleted by AJR
 
623
%will make sense.  Besides, the most pressing need for me is to get
 
624
%ESS-elsewhere to work with ESS[BUGS] rather than creating inferior-BUGS.
 
625
 
 
626
%\item[Rich:] How does making ``ESS-elsewhere work with ESS[BUGS]'' differ
 
627
%from ``creating inferior-BUGS''?  My question is predicated on the assumption
 
628
%that ESS-elsewhere is a (generalized) minor-mode that makes the location
 
629
%of the program irrelevant.
 
630
%See my ESS-elsewhere quibble below.
 
631
 
 
632
%\item[Rodney:] It's the whole batch BUGS vs. interactive BUGS thing.  Batch
 
633
%BUGS with ESS-elsewhere; interactive BUGS with inferior-BUGS which does not
 
634
%and will never exist.  If you want to call ``inferior-ESS'' ``ESS-elsewhere''
 
635
%why do you need two different names?  ``inferior-ESS'' is a terrible name
 
636
%so the change would be fine with me, but you can't have it both ways?  Is
 
637
%this why you keep saying that ESS-elsewhere works for SAS?  See
 
638
%response to quibble below.
 
639
 
 
640
%\item[Rich:]
 
641
%\stexttt{iESS[SAS]} was designed to mimic as well as possible \stexttt{iESS[S]}.
 
642
%I need to read doc/README.SAS to make sure all of its options are represented
 
643
%here. --- Not yet done.
 
644
%\end{description}
 
645
%\end{Comment}
 
646
 
 
647
\paragraph{Simplifying Keymap Differences.}
 
648
Simple conflicts between interfaces are exemplified by different key
 
649
sequences for editing tasks such as cut, copy, paste, beginning of
 
650
line, end of line, etc.  These may be the most aggravating because our
 
651
fingers are typing ``instinctively'', but differences in interfaces
 
652
circumvent this learned behavior.  ESS solves this problem by
 
653
providing a uniform interface to keyboard actions across the variety
 
654
of statistical packages that might be used.  That is, the same key
 
655
sequences are used for cursor movement, evaluation, and basic tasks
 
656
such as loading files for editing.
 
657
 
 
658
\paragraph{Concurrent Use of Multiple Machines and Operating Systems.}
 
659
It can be useful to have multiple statistical processes running
 
660
simultaneously, either on a single machine or a variety of machines.
 
661
This capability assists with large-scale numerical simulations as well
 
662
as code design and testing across multiple versions of statistical
 
663
software packages.
 
664
 
 
665
\subsection{Interactive Processing.}
 
666
\label{sec:interactive}
 
667
 
 
668
The increased popularity of exploratory data analysis as well as the
 
669
advent of simple GUIs has made interactive data analysis an important
 
670
component to statistical practices.
 
671
ESS uses three different approaches for communicating with statistical
 
672
packages.
 
673
 
 
674
\paragraph{Inter-Process Communication.}
 
675
Packages that use the command-line interface are run as an inferior
 
676
process in an Emacs buffer, with the standard input and output of the
 
677
package redirected to the buffer.  Packages that do not use the
 
678
command-line interface must be run as an independent process, possibly
 
679
with limited cooperation.
 
680
 
 
681
ESS can use the Windows DDE (Dynamic Data Exchange) protocol to
 
682
provide one-way communication directly to packages which function as a
 
683
DDE server.  ESS can control the actions of the package, but it can not capture
 
684
the results directly.  Transcripts must be physically copied to an
 
685
Emacs buffer to get the transcript editing features.
 
686
 
 
687
Statistical packages that use neither the standard input/standard
 
688
output protocol nor DDE can not be directly controlled by Emacs.  But, ESS
 
689
can still provide an editing environment for these statistical languages.  The
 
690
user must either manually cut and paste the edited code into the
 
691
package or save the edited files and run them in a batch environment.
 
692
The Microsoft Windows versions of \SAS, \Stata, and \XLispStat\ are
 
693
in this category.
 
694
 
 
695
One useful extension in ESS is relaxation of the requirement that the
 
696
statistics program be available on the local machine.  ESS provides
 
697
both transparent editing of files and execution of statistics packages
 
698
on a remote machine with \stexttt{iESS[S]} or \stexttt{iESS[SAS]} (see
 
699
below).  All the editing and interaction features described for the
 
700
local machine work equally well on the remote machine.  The
 
701
interaction, including all the unique features of working with ESS,
 
702
appears to the user as if the program were running on the local
 
703
%rmh: The interaction ... appears ....
 
704
machine.  If the X11 Windowing system is running on the local machine,
 
705
it is even possible to bring up visual displays and graphics from
 
706
remote Unix systems onto a local Microsoft Windows or Apple Mac
 
707
display.
 
708
 
 
709
\paragraph{Interactive S family}
 
710
ESS for S family statistical languages, \stexttt{iESS[S]},
 
711
replaces the \Splus\ Commands window or the R GUI window.  In addition
 
712
to running the S family language process, \stexttt{iESS[S]} mode provides the
 
713
same editing features, including syntactic highlighting and
 
714
string-search, as the editing mode \stexttt{ESS[S]}.  It also provides
 
715
an interactive history mechanism; transcript recording and editing;
 
716
and the ability to re-submit the contents of a multi-line command to
 
717
the executing process with a single keystroke.  \stexttt{iESS[S]} is
 
718
used with S, \Splus, and R on Unix and with Sqpe and R on Windows.
 
719
 
 
720
The \Splus\ GUI on Windows can be a DDE server.  There are two
 
721
advantages to using even this limited communication with the \Splus\
 
722
GUI through ESS.  First, through \stexttt{ESS[S]} mode the user gets
 
723
the full editing capabilities of Emacs.  Second, S language commands
 
724
% rmh: S, not \Splus, in both places.  The {\it language} is S.
 
725
% The previous session could be R or ATT S.  It is not restricted to \Splus.
 
726
are sent from the editing mode \stexttt{ESS[S]} buffer and from
 
727
transcript buffers from previous S sessions directly to the GUI
 
728
Commands window with the same Emacs key sequences as are used with ESS
 
729
on Unix.  Hence the user can work in a powerful editing environment
 
730
and is protected from the delay and ergonomic challenges of using the
 
731
mouse for copy and paste operations across windows.
 
732
 
 
733
\paragraph{Interactive \SAS.}
 
734
\stexttt{iESS[SAS]} is a mode that allows text-based \stexttt{PROC} by
 
735
\stexttt{PROC} interaction with an inferior buffer running an
 
736
interactive \SAS\ session on either the local or a remote computer.
 
737
\stexttt{iESS[SAS]} mode works by redirecting standard input and
 
738
output from \SAS\ to ESS.  Currently, the \stexttt{iESS[SAS]} mode can
 
739
run on any computer, but the \SAS\ process it is controlling must be
 
740
running on a Unix machine.  This process is very efficient for dial-up
 
741
network connections to a remote computer with \SAS\ installed.  The
 
742
resulting interface is similar to the SAS character terminal
 
743
interface, but with Emacs key sequences.
 
744
 
 
745
%Rodney:  What is this paragraph about?  I'm going to comment it out
 
746
%because I don't recognize what it is supposed to be.  Maybe somebody
 
747
%can fix it later.
 
748
%
 
749
% rmh: Round umpteen.  Yes, this is redundant with the third paragraph
 
750
% of interprocess communication.  I still want it here.  Try this rephrasing.
 
751
%
 
752
\stexttt{ESS[SAS]} mode can be used in conjunction with the \SAS\
 
753
Display Manager to allow simultaneous access to Emacs for editing
 
754
\SAS\ language code and to the \SAS\ mouse-based interfaces to the
 
755
graphical routines and help system.
 
756
 
 
757
%%%%% AJR: WHY IS THIS SUBSTANTIALLY DIFFERENT THAN BATCH?  I KNOW ITS
 
758
%%%%% SLIGHTLY DIFFERENT, BUT SUBSTANTIALLY?
 
759
%%%%% rmh: this is a form of interaction, not batch.  I restored the
 
760
%%%%% first paragraph with some expansion.
 
761
%\paragraph{\SAS---Interactive cooperation with the \SAS\ Display Manager.}
 
762
%ESS users who write data analysis code in \stexttt{ESS[SAS]} mode in Emacs
 
763
%often need to work with the \SAS\ Display Manager's
 
764
%mouse-based interface to the graphical
 
765
%routines, the help system, and other non-text-based features.
 
766
%%The authors of ESS prefer the Emacs environment for
 
767
%%the text-file interaction with \SAS, that is with editing and
 
768
%%managing input command files and output listing and log files,
 
769
%%even on computer systems which run
 
770
%%the \SAS\ Display Manager environment.
 
771
%In this situation, the user
 
772
%designs the command file in \stexttt{ESS[SAS]} mode and highlights
 
773
%regions to be forwarded to \SAS\ for processing.
 
774
%%
 
775
%% Rodney: I don't see this as a feature of either ESS or emacs.  And,
 
776
%% what the authors prefer is certainly not germane.
 
777
%%
 
778
%%
 
779
%% rmh: This is my preferred mode for interacting with SAS.  I tried another
 
780
%% rephrasing.  It {\it is} a feature of ESS.  ESS is able to provide ESS[SAS]
 
781
%% mode for the text processing (.sas .lst. log files) and simultaneously
 
782
%% let the user have interactive graphical access.
 
783
%%This can be done by either:
 
784
%%\begin{enumerate}
 
785
%%\item copying and pasting the marked regions to the \SAS\ Editor window
 
786
%%  and then pressing the \stexttt{RUN} button.  Highlighted sections of
 
787
%%  the \SAS\ Listing window are brought back to Emacs to be read in the
 
788
%%  \stexttt{ESSlst} mode editing environment.
 
789
%%\item submitting the marked region for Batch File Processing (see the
 
790
%%  next section) but using the mapped key sequences to append to the log
 
791
%%  and listing files instead of replacing them.
 
792
%%\end{enumerate}
 
793
 
 
794
\subsection{Batch File Processing.}
 
795
\label{sec:batch-file}
 
796
 
 
797
Batch file processing with statistical analysis packages is a better
 
798
choice than interactive processing when the execution times are longer
 
799
than the user is willing to wait as well as for regularly updated
 
800
statistical reports and figures.  ESS provides a means to shorten the
 
801
debugging cycle for writing code intended for batch evaluation by
 
802
containing the whole process, both writing and evaluation, within
 
803
Emacs.
 
804
 
 
805
\paragraph{Batch \SAS.}
 
806
\label{sec:sas-batch}
 
807
 
 
808
\SAS\ is a popular choice for processing and analyzing large amounts
 
809
of data.  However, interactive \SAS\ is rarely used in these situations
 
810
due to the length of time involved.  Instead, a file containing \SAS\
 
811
commands is created and \SAS\ executes these commands in the background,
 
812
or batch, while the user moves on to other activities.
 
813
 
 
814
ESS facilitates \SAS\ batch with \stexttt{ESS[SAS]}, the mode for files
 
815
with the \stexttt{sas} extension.  ESS defines \SAS\ syntax so that
 
816
\stexttt{font-lock-mode} can highlight statements, procedures,
 
817
functions, macros, datasets, comments and character string literals in
 
818
\SAS\ programs.  Optionally, the same language features are
 
819
highlighted in the \SAS\ log with the addition of log notes, warnings
 
820
and error messages.
 
821
 
 
822
For files with the \stexttt{sas} extension, ESS binds the function
 
823
keys in \stexttt{ESS[SAS]} mode to match the definitions used by \SAS\
 
824
Display Manager.  These definitions are optionally available in all
 
825
modes.  They are particularly useful when viewing \SAS\ log and
 
826
listing files (with extensions of \stexttt{log} and \stexttt{lst}
 
827
respectively).
 
828
 
 
829
Only one function key press is needed to submit a \SAS\ batch process.
 
830
Other function keys open the \SAS\ program, the \SAS\ log and the
 
831
\SAS\ listing buffers.  When accessed in this manner, the \SAS\ log
 
832
and \SAS\ listing buffers are automatically updated since they may
 
833
have been appended or over-written by the \SAS\ batch process.  In
 
834
addition, the \SAS\ log is searched for error messages and the error
 
835
messages, if any, are sequentially displayed with consecutive key
 
836
presses.
 
837
 
 
838
Another function key opens a \SAS\ permanent dataset for editing or
 
839
viewing.  An option is provided so that the tab and return keys
 
840
operate in typewriter fashion like they do in \SAS\ Display Manager.
 
841
This option also defines a key to move the cursor to a previous
 
842
tab-stop and delete any characters between its present position and
 
843
the tab-stop.  This is a \SAS\ Display Manager feature that is not
 
844
typically available in Emacs.
 
845
 
 
846
The \SAS\ batch process runs on the computer where the \SAS\ program
 
847
resides.  This is important because any \SAS\ permanent datasets
 
848
referenced in a \SAS\ program only exist on the computer running \SAS.
 
849
If the \SAS\ program resides on a remote computer, then the
 
850
log and listing are also accessed remotely.  The net result is that
 
851
running \SAS\ batch on remote computers is nearly transparent to the
 
852
ESS user.
 
853
 
 
854
%\begin{Comment}
 
855
%Rich's version:
 
856
%\end{Comment}
 
857
%The \SAS\ batch process can run on the same computer on which the
 
858
%emacs session is running or it can run on a remote computer.  For
 
859
%remote jobs, files are transparently saved (with ftp or scp or kermit)
 
860
%and the batch process is transparently submitted through a telnet or
 
861
%ssh connection.
 
862
 
 
863
%\begin{Comment}
 
864
%Rich: I have some terminology quibbles here with how the term
 
865
%``ESS-elsewhere'' is used with SAS BATCH.  I think of S-elsewhere or
 
866
%ESS-elsewhere as a trick to make a \stexttt{telnet-mode} buffer think
 
867
%it is \stexttt{iESS-mode} buffer.
 
868
 
 
869
%I don't think of file saving, editing, and retrieval as an example
 
870
%of ESS-elsewhere.   Neither is submission of the remote job;
 
871
%that is just an ordinary shell command in an ordinary shell buffer.
 
872
%M-x SAS probably is an example of ESS-elsewhere, but I
 
873
%designed it before I thought of the ESS-elsewhere concept.
 
874
 
 
875
%The initial idea behind S-elsewhere was to run an interactive S or S-Plus
 
876
%session on a remote computer in telnet (or equivalent) buffer.  The trick
 
877
%was to make the \stexttt{telnet-mode} buffer accept C-c C-n and
 
878
%related commands from the \stexttt{S-mode} buffers.  Hence I had to
 
879
%make the \stexttt{telnet-mode} buffer think it is \stexttt{iESS-mode}
 
880
%buffer.  The ``elsewhere'' part of the name is entirely related to a
 
881
%different start up procedure.  Once the connection is made, there is
 
882
%{\em no} difference visible to the user.  The buffer shows itself to
 
883
%be an ordinary \stexttt{iESS} buffer.  Tony generalized S-elsewhere
 
884
%to ESS-elsewhere to allow other languages than S to be used
 
885
%interactively.
 
886
 
 
887
%I have been using ESS for SAS remote BATCH for years, ever since you
 
888
%and I started working on this together.  We initially defined
 
889
%ess-sas-submit-method to encapsulate the location of the sas process.
 
890
%Except for a few lines of elisp to get the connection started, the user
 
891
%behavior has been identical whether the SAS process is on the same or
 
892
%different machine.  Since we are not interactively talking to the SAS
 
893
%process in an inferior-ESS buffer I don't see this as ESS-elsewhere.
 
894
 
 
895
%Rodney: Remote submissions of SAS batch jobs never worked.  I only got
 
896
%it to work a couple of weeks ago.  The problem was with the cd command.
 
897
%You need to ignore the beginning and end of the expanded buffer name
 
898
%that are the ange-ftp/EFS/tramp stubs which tell Emacs what the remote
 
899
%username and hostname are.  I find the batch usage of ESS-elsewhere
 
900
%entirely consistent with the interactive behavior.  OTOH, I don't find
 
901
%the terminology particularly illuminating.  I think ESS-remote or
 
902
%ESS-net would be more meaningful.
 
903
%\end{Comment}
 
904
 
 
905
\paragraph{Batch BUGS.}
 
906
BUGS software performs Markov Chain Monte Carlo integration.  There is
 
907
an interactive capability, but it is not often used since the analyses
 
908
can be very time-consuming.  Most BUGS programs are executed as batch
 
909
processes.  ESS facilitates BUGS batch with \stexttt{ESS[BUGS]}, the
 
910
mode for files with the \stexttt{bug} extension.  ESS provides 4
 
911
features.  First, BUGS syntax is described to allow for proper
 
912
fontification of statements, distributions, functions, commands and
 
913
comments in BUGS model files, command files and log files.  Second,
 
914
ESS creates templates for the command file from the model file so that
 
915
a BUGS batch process can be defined by a single file.  Third, ESS
 
916
provides a BUGS batch script that allows ESS to set BUGS batch
 
917
parameters.  Finally, key sequences are defined to create a command
 
918
file and submit a BUGS batch process.
 
919
 
 
920
\paragraph{Batch S family.}
 
921
ESS provides 2 facilities for batch processing of S family language files.
 
922
The first is to execute the contents of a file using buffer-evaluation.  This
 
923
differs from interactive processing only by the number of commands
 
924
being evaluated; errors can be found by examining the resulting
 
925
transcript.  The second is the load-source mechanism, which provides a
 
926
means of jumping to errors in the source file, but doesn't display the
 
927
evaluated commands in the transcript.  These mechanisms provide
 
928
different tools for debugging the source files.
 
929
 
 
930
\section{History of ESS}
 
931
\label{sec:ESS:history}
 
932
 
 
933
ESS is built on Emacs, the editing system for which Richard Stallman
 
934
won a MacArthur Foundation Fellowship in 1990.  Emacs has a long
 
935
history of being a programmer's editor.  Many statisticians got their
 
936
first taste of the power of Emacs with \Fortran\ mode which was
 
937
introduced in 1986.  As statisticians' preferences changed from
 
938
generalist compiled languages such as \Fortran\ to specialist
 
939
statistical analysis packages like S and \SAS, Emacs modes soon
 
940
followed.
 
941
 
 
942
The ESS environment is built on the open-source projects of
 
943
many contributors, dating back over 10 years.
 
944
Doug Bates and Ed Kademan wrote S-mode in 1989 to edit S and \Splus\
 
945
files in GNU Emacs.  Frank Ritter and Mike Meyer added features,
 
946
creating version 2.  Meyer and David Smith made further contributions,
 
947
creating version 3.  For version 4, David Smith provided significant
 
948
enhancements to allow for powerful process interaction.
 
949
 
 
950
John Sall wrote GNU Emacs macros for \SAS\ source code around 1990.
 
951
Tom Cook added functions to submit jobs, review listing and log files,
 
952
and produce basic views of a dataset, thus creating a SAS-mode which was
 
953
distributed in 1994.
 
954
 
 
955
In 1994, A.J. Rossini extended S-mode to support XEmacs.  Together
 
956
with extensions written by Martin M{\"a}chler, this became version
 
957
4.7 and supported S, \Splus, and R.
 
958
In 1995, Rossini extended SAS-mode to work with XEmacs.
 
959
 
 
960
In 1997, Rossini merged S-mode and SAS-mode into a single Emacs
 
961
package for statistical programming; the product of this marriage was
 
962
called ESS version 5.  Richard M. Heiberger designed the inferior mode
 
963
for interactive \SAS\ and SAS-mode was further integrated into ESS.
 
964
Thomas Lumley's Stata mode, written around 1996, was also folded into
 
965
ESS.  More changes were made to support additional statistical
 
966
languages, particularly \XLispStat.
 
967
 
 
968
ESS initially worked only with Unix statistics packages that used
 
969
standard-input and standard-output for both the command-line interface
 
970
and batch processing.  ESS could not communicate with statistical
 
971
packages that did not use this protocol.  This changed in 1998 when
 
972
Brian Ripley demonstrated use of the Windows Dynamic Data Exchange
 
973
(DDE) protocol with ESS.  Heiberger then used DDE to provide
 
974
interactive interfaces for Windows versions of \Splus.  In 1999,
 
975
Rodney A. Sparapani and Heiberger implemented \SAS\ batch for ESS, which
 
976
relies on files rather than standard-input/standard-output, on Unix,
 
977
Windows and Mac.  In 2001, Sparapani added BUGS batch file processing
 
978
to ESS for Unix and Windows.
 
979
 
 
980
This history is summarized in Table \ref{tab:timeline}.
 
981
 
 
982
\begin{table}[tbp]
 
983
  \centering
 
984
  {\scriptsize
 
985
  \begin{tabular}{c ll c ll}
 
986
\hline
 
987
    Year  \\
 
988
\hline
 
989
         & \multicolumn{2}{c}{S-mode}       && \multicolumn{2}{c}{SAS-mode} \\
 
990
\cline{2-3} \cline{5-6}
 
991
    1989 & v.1 & (GNU Emacs, Unix, S/S+)        &&  \\
 
992
    1990 &     &                            &&     & (GNU Emacs, Unix, SAS editing) \\
 
993
    1991 & v.2 & (GNU Emacs, Unix, S/S+)        && \\
 
994
    1993 & v.3 & (GNU Emacs, Unix, S/S+)        && \\
 
995
    1994 & v.4 & (GNU Emacs/XEmacs, Unix, S/S+) && v.1  & (GNU Emacs, Unix, SAS batch) \\
 
996
    1995 & v.4.7 & (GNU Emacs/XEmacs, Unix, S/S+/R) && v.2 & (GNU Emacs/XEmacs, Unix, SAS batch) \\
 
997
    \cline{2-6}\\[-3.5ex]
 
998
    \cline{2-6}
 
999
         & \multicolumn{5}{c}{Emacs Speaks Statistics (ESS)} \\
 
1000
    \cline{2-6}
 
1001
         &\multicolumn{2}{c}{Emacs, Operating Systems} &&\multicolumn{2}{c}{Additional Functionality}\\
 
1002
\cline{2-3} \cline{5-6}
 
1003
    1997 & v.5.0 & (GNU Emacs/XEmacs, Unix)         &&&  Stata, XLispStat, SAS interactive \\
 
1004
    1998 & v.5.1.1 & (GNU Emacs/XEmacs, Unix/Windows) &&&  S+elsewhere; Windows: S+/R\\
 
1005
    1999 & v.5.1.10 & (GNU Emacs/XEmacs, Unix/Windows/Mac) &&& SAS batch; Omegahat \\
 
1006
    2001 & v.5.1.19 & (GNU Emacs/XEmacs, Unix/Windows/Mac) &&& Unix/DOS: BUGS batch; Mac: R \\
 
1007
%%    2002 & v.5.1.20 & (Emacs/XEmacs, Unix/Windows/Mac) &&& Unix/DOS: BUGS batch, Mac: R \\
 
1008
%%    2002 & v.5.2 & (Emacs/XEmacs, Unix/Windows/Mac) &&& ? \\
 
1009
    \hline
 
1010
  \end{tabular}
 
1011
  }
 
1012
  \caption{History and Ancestors of ESS}
 
1013
  \label{tab:timeline}
 
1014
\end{table}
 
1015
 
 
1016
 
 
1017
%\section{Future Work}
 
1018
 
 
1019
%%%There are two active areas of extensions for user environments.  One
 
1020
%%%is to enhance the capabilities of the IDE for statistical practice;
 
1021
%%%this includes implementing such common IDE features as object
 
1022
%%%browsers, tool-tips, and interfacing cleaning.  The other is to target
 
1023
%%%appropriate potentially useful programming methodologies for transfer
 
1024
%%%to statistical practice.
 
1025
%%%
 
1026
%%%Literate Programming methodologies \citep{Knuth:1992,NRamsey:1994} are
 
1027
%%%a natural fit for statistical practice.  We refer to the application
 
1028
%%%to statistical analysis as Literate Statistical Practice
 
1029
%%%\citep{rossini:dsc:2001}.  The tools used are Noweb
 
1030
%%%\citep{NRamsey:1994} and either \LaTeX, \textsc{html}, or \textsc{xml}
 
1031
%%%for documenting and explaining the analysis.  This approach to
 
1032
%%%programming encourages the use of a literary documentation style to
 
1033
%%%explain the programming code for the data analysis.  The program can
 
1034
%%%then be extracted from the documentation text for realizing the
 
1035
%%%statistical analysis.
 
1036
 
 
1037
%%future enhancement perhaps
 
1038
%%ESS provides the same ESS-elsewhere support for BUGS batch
 
1039
%%that it does for \SAS\ batch (see above).
 
1040
 
 
1041
%Important extensions which should be implemented in future
 
1042
%versions include class browsers, analysis templates, tool-tips, and
 
1043
%similar features.  Class browsers can be thought of as a tree or
 
1044
%outline for presenting datasets, variables and functions in the
 
1045
%context of what they represent; this allows for rapid and appropriate
 
1046
%inspection.  Analysis templates would allow statistics centers and
 
1047
%groups to provide standardized templates for initiating an analysis.
 
1048
 
 
1049
%Additional statistical packages can easily be added to ESS.
 
1050
 
 
1051
%%While most IDE features have been developed for object-oriented
 
1052
%%languages, the above also can apply to non-object oriented
 
1053
%%programming.
 
1054
 
 
1055
%ESS is one of the first  Rapid Application Development (RAD)
 
1056
%environments intended for statisticians.  It provides
 
1057
 
 
1058
 
 
1059
\section{Conclusion}
 
1060
\label{sec:concl}
 
1061
 
 
1062
ESS provides an enhanced, powerful interface for efficient interactive
 
1063
data analysis and statistical programming.  It allows the user
 
1064
complete control over the communications among the files in which the
 
1065
analysis is specified, the statistical process doing the computation,
 
1066
and the output.  Because all are within the same programming
 
1067
environment, and therefore are accessed with the same editing and
 
1068
searching concepts and the same key sequences, user efficiency is
 
1069
increased.  It is completely customizable to satisfy individual
 
1070
desires for interface styles and can be extended to support other
 
1071
statistical languages and data analysis packages.
 
1072
 
 
1073
%\begin{Comment}
 
1074
%Rich: see my discussion of ESS-elsewhere terminology.
 
1075
 
 
1076
%What is the behavior for remote SAS that is new for 2002?
 
1077
 
 
1078
%Rodney: SAS batch now works and Kermit was added as a method of transfer.
 
1079
%\end{Comment}
 
1080
%ESS-elsewhere provides interactive and batch processing
 
1081
%with \SAS\ running on a remote machine that is accessed over a
 
1082
%network.  This provides a powerful development environment for \SAS.
 
1083
 
 
1084
%%This
 
1085
%%includes support for syntax highlighting and template-based source file
 
1086
%%generation that provides the capability of specifying all the necessary
 
1087
%%parameters for a BUGS batch run in a single file.
 
1088
 
 
1089
\bibliographystyle{plainnat}
 
1090
\pdfbookmark[1]{References}{section.7}
 
1091
%\addcontentsline {toc}{section}{\numberline {}References}
 
1092
\bibliography{ess-intro-graphs}
 
1093
 
 
1094
\clearpage
 
1095
 
 
1096
\appendix
 
1097
\section{Appendix: ESS Resources on the Internet}
 
1098
%\addcontentsline {toc}{section}{\numberline {}ESS Resources on the Internet}
 
1099
\label{sec:access}
 
1100
 
 
1101
\paragraph{Latest Version.}
 
1102
 
 
1103
ESS is constantly in flux.  New versions of statistical
 
1104
packages, Emacs and operating systems require new releases of ESS to
 
1105
support them.  The latest stable version of ESS can be found on the web at
 
1106
\url{http://software.biostat.washington.edu/statsoft/ess/}.  To get help
 
1107
with problems, send e-mail to \url{mailto: ess-help@stat.math.ethz.ch}.
 
1108
The latest development, hence unstable, version can be obtained by
 
1109
anonymous CVS.  First type:
 
1110
 
 
1111
\stexttt{cvs -d
 
1112
  :pserver:anoncvs@software.biostat.washington.edu:/var/anoncvs login}
 
1113
 
 
1114
You will be prompted for a password which is ``\stexttt{anoncvs}''.
 
1115
Then type:
 
1116
 
 
1117
\stexttt{cvs -d
 
1118
  :pserver:anoncvs@software.biostat.washington.edu:/var/anoncvs co
 
1119
  ess}
 
1120
 
 
1121
\paragraph{Additional documentation.}
 
1122
 
 
1123
An expanded version of the present paper is in \citep{RMHHS:2001}.  A
 
1124
general introduction and usage instructions can be found in
 
1125
\citep{heiberger:dsc:2001}; in addition, one which is more focused on
 
1126
\SAS\ can be found in \citep{heiberger:philasugi:2001}.  The
 
1127
documentation that comes with ESS provides details of its
 
1128
implementation as well as examples of its use.
 
1129
 
 
1130
\end{document}
 
1131
 
 
1132
 
 
1133
%%% Local Variables:
 
1134
%%% mode: latex
 
1135
%%% TeX-master: t
 
1136
%%% End: