ESS[SAS]: somebody forgot about the SUM statement (probably me)
[ess.git] / doc / rmh-talk.tex
blob5ee9a1c9dc1a338b29b8949c0c54c2032d8cb4b4
1 %% Slides given at S-PLUS Users Conference, October 1997, by RMH.
3 \documentclass[12pt]{article} %latex2e
4 \usepackage{slverb} %latex2e
5 %\documentstyle[12pt]{article} %latex 2.09
7 % Warning: do not compress blanks into tabs.
8 % It will destroy the spacing in the S functions in the Example environment.
10 %\newfont{\sltt}{cmsltt10 scaled\magstep3} % load slant tt font Large
11 \newfont{\sltt}{cmsltt10 scaled\magstep5} % load slant tt font Huge %duplicate for Huge
12 \newfont{\slttH}{cmsltt10 scaled\magstep5} % load slant tt font Huge
13 \newfont{\ttHuge}{cmtt12 scaled\magstep4} % load tt font Huge
14 \newfont{\itHuge}{cmti12 scaled\magstep4} % load italic font Huge
16 \newcommand{\LB}{{\tt\char'173}} % \tt {
17 \newcommand{\RB}{{\tt\char'175}} % \tt }
18 \newcommand{\BS}{{\tt\char'134}} % \tt \
19 \newcommand{\HH}{{\tt\char'043}} % \tt #
20 %\newcommand{\slLB}{{\sltt\char'173}} % \sltt {
21 %\newcommand{\slRB}{{\sltt\char'175}} % \sltt }
22 %\newcommand{\slBS}{{\sltt\char'134}} % \sltt \
23 %\newcommand{\slHH}{{\sltt\char'043}} % \sltt #
24 \newcommand{\slLBH}{{\slttH\char'173}} % \slttH {
25 \newcommand{\slRBH}{{\slttH\char'175}} % \slttH }
26 \newcommand{\slBSH}{{\slttH\char'134}} % \slttH \
27 \newcommand{\slHHH}{{\slttH\char'043}} % \slttH #
28 % These commands give the stated character in the correct font in LaTeX.
29 % Beware of spacing in the "Example" environment, where spaces are significant:
30 % "\LB{}contents\RB" produces "{contents}"
31 % "\LB contents \RB" produces "{ contents }"
34 \newcommand{\hlinefill}{\mbox{\rule{0pt}{1ex}}\hrulefill}
37 \pagestyle{empty}
38 \topskip -1in
39 \topmargin -1in
40 \textheight 7.5in
41 \raggedbottom
43 \textwidth 10in
44 \parindent 0in
45 \oddsidemargin -.5in
47 \special{landscape}
49 \newcommand{\la}{{\rm\Huge$\leftarrow$}}
51 \newcommand{\mc}[1]{\multicolumn{2}{l}{#1}}
52 \newcommand{\marpar}[1]{\marginpar{\raggedright#1}}
53 \newcommand{\Twiddle}{$\sim$}
55 %10pt
56 %\newenvironment{exsf}{\begin{list}{}{\setlength{\leftmargin}{\parindent}}\item[]\small\sf}{\end{list}}
58 %12pt
59 %\newenvironment{exsf}{\begin{list}{}{\setlength{\leftmargin}{\parindent}}\item[]\small\sf\boldmath}{\end{list}}
61 %12pt Huge
62 \newenvironment{exsf}{\begin{list}{}{\setlength{\leftmargin}{\parindent}}\item[]\sf\boldmath}{\end{list}}
64 \newcommand{\s}[1]{\mbox{\protect\small\sf#1}}
65 \newcommand{\msf}[1]{\mbox{\tiny\sf #1}}
66 \newcommand{\msm}[1]{\mbox{\scriptsize$#1$}}
68 %\renewcommand{\topfraction}{1.}
69 %\renewcommand{\bottomfraction}{0.}
70 %\renewcommand{\textfraction}{0.}
71 %\renewcommand{\floatpagefraction}{1.}
72 %\renewcommand{\floatsep}{0pt}
73 %\renewcommand{\textfloatsep}{0pt}
74 %\setcounter{topnumber}{25}
75 %\setcounter{bottomnumber}{0}
76 %\setcounter{totalnumber}{25}
78 %\renewcommand{\dbltopfraction}{1.}
79 %\renewcommand{\dblfloatpagefraction}{1.}
80 %\renewcommand{\dblfloatsep}{0pt}
81 %\renewcommand{\dbltextfloatsep}{0pt}
82 %\setcounter{dbltopnumber}{25}
84 \newcommand{\shortspace}{
85 \setlength{\topsep}{0in}
86 \setlength{\itemsep}{0in}
87 \setlength{\parsep}{0in}
88 \setlength{\parskip}{0in}
91 \begin{document}
92 \Huge
93 \parskip=1ex
96 \begin{center}
97 \Huge
98 ESS-mode and S-Plus\\
99 Richard M. Heiberger\\[1ex]
100 based on joint work with\\
101 A.J. Rossini(U South Carolina),\\
102 Kurt Hornik(TU-Wien), and Martin Maechler (ETHZ).\\[2ex]
103 Thanks also to\\
104 Doug Bates, Ed Kademan, Frank Ritter (initial versions),\\
105 and David Smith (3.x, 4.x)\\[3ex]
107 Richard M. Heiberger\\[.4ex]
108 Temple University\\[.4ex]
109 Philadelphia, PA 19122-2585\\[.4ex]
110 {\sf rmh@astro.ocis.temple.edu}\\[2ex]
111 S-PLUS Users Conference, Seattle, October 1997
112 \end{center}
115 \newpage
116 \begin{center}Abstract\end{center}
117 ESS [Emacs Speaks Statistics] (formerly S-mode) is a a GNU Emacs
118 package for running S(plus), R, X-LispStat, SAS and potentially other
119 interactive `statistical' languages in an `inferior' buffer, editing
120 source code in these languages and interacting with the running
121 program. This talk will discuss the capabilities and advantages of
122 using ESS as the primary interface to Splus.
125 I am talking about the version which will be released in November 1997
126 as ESS-5.0.\\
127 \hspace*{2ex}{\sf http://franz.stat.wisc.edu/pub/ESS/ESS-5.0.tar.gz}\\
128 \hspace*{2ex}{\sf ftp://franz.stat.wisc.edu/pub/ESS/ESS-5.0.tar.gz}\\
129 The previous stable version was 4.8 in
130 {\sf S-mode-4.8.MM6.XE2.tar.gz}
132 \newpage
134 What is S-Plus
136 What is EMACS
138 What is ESS-mode
140 Why should I use ESS-mode with S-Plus
142 Other features in ESS-mode
144 \newpage
145 \begin{itemize}
146 \item
147 What is S-Plus?
149 The best, most expressive, most fun, most powerful environment and
150 program for designing methods for statistical analysis of data and for
151 displaying and analyzing data.
153 \newpage
154 \item
155 What is EMACS?
157 A text editor that is fully configurable and extensible, can work with
158 many files simultaneously, interacts with the computer operating
159 system and other executing processes, has language specific
160 customizations, and can indeed do anything (the previous edition
161 iconized to the Kitchen Sink).
163 In addition to S, Emacs has modes designed for \TeX, \LaTeX, fortran,
164 c, lisp, text, directories, telnet, rlogin, terminal emulators, nroff,
165 pascal, c++, ada, asm, etc.
167 Mode customizations include indentation patterns, syntactic
168 highlighting, comment structure, and interaction with the program that
169 uses the file as input.
171 \newpage
172 \item
173 What is ESS-mode?
175 A package written in emacs which is designed to work with Statistical
176 software. The initial development under the name S-mode was designed
177 for S. It has been extended to dialects of S (S-Plus, S4, R) and now
178 to other statistical packages (SAS, Xlispstat). With the extension
179 came the name change to ESS-mode (Emacs Speaks Statistics).
181 There are three primary components to ESS
182 \begin{description}
183 \item [S-mode] for editing {\tt myfile.s} and submitting individual
184 lines and paragraphs of S code to the running S process.
185 \item [inferior-ess-mode] for executing an S process inside an emacs buffer.
186 \item [S-transcript-mode] for reviewing and possibly re-executing the
187 transcript of a previous S process.
188 \end{description}
191 \item
192 Why should I use ESS-mode with S-Plus?
194 It will improve your productivity.
197 \newpage
198 {\bf S-mode.} Automatic syntactic indentation and highlighting of source
199 \vspace*{-.5ex}
202 \underline{\slttH \slHHH\slHHH as typed -- too long. Line is folded}\\
203 {\tt case0701 <- read.table(file={\slttH'case0701.asc'}, header\BS} \\
204 {\tt =\underline{T})}\\
205 \vspace*{.0ex}
207 \underline{\slttH{\slHHH\slHHH insert line break, syntactic indentation lost}}\\
208 \tt{case0701 <- read.table(file={\slttH'case0701.asc'},}\\
209 \tt{header=\underline{T})}\\
210 \vspace*{.0ex}
212 \underline{\slttH{\slHHH\slHHH automatic indentation at right parenthesis level}}\\
213 \tt{case0701 <- read.table(file={\slttH'case0701.asc'},}\\
214 \tt\verb+ header=+\underline{T})\\
215 \vspace*{.0ex}
217 Here by font, on a terminal by color.\\
218 \underline{\slttH{\slHHH\slHHH comments}}~~~~~~~{\rm underlined italic}\\
219 {\slttH"quoted strings"}~{\rm italic}\\
220 \underline{keywords}~~~~~~~~~{\rm underlined}
224 \newpage
225 {\bf S-mode.} Fill-paragraph understands comments.
226 \vspace*{2ex}
228 Too long and folded.\\
229 \underline{\slttH\slHHH\slHHH~Sometimes statements are complicated with many}\BS\\
230 \underline{\slttH levels of}\\
231 \underline{\slttH\slHHH\slHHH~ parentheses. ESS gets the indentation right.}
232 \vspace*{3ex}
234 Fill-paragraph broke lines evenly and generated the comment symbols.\\
235 \underline{\slttH\slHHH\slHHH~Sometimes statements are complicated with}\\
236 \underline{\slttH\slHHH\slHHH~many levels of parentheses. ESS gets the}\\
237 \underline{\slttH\slHHH\slHHH~indentation right.}
239 \newpage
240 {\bf S-mode.} Detects unbalanced parentheses
241 \vspace*{2ex}
243 \underline{\slttH\slHHH\slHHH~Complicated statement}
245 {\ \tt if ((abs(end(x) + tspar(x)["deltat"] - start(y))}\\
246 {\ \tt \hspace*{3em}< eps) \&\&}\\
247 {\ \tt \hspace*{2.5em}(frequency(x) == frequency(y)) \&\&}\\
248 {\ \tt \hspace*{2.5em}\fbox{\slttH(}(length(units(x))==0) ||}\\
249 {\ \tt \hspace*{3em}(length(units(y))==0) ||}\\
250 {\ \tt \hspace*{3em}(units(x) == units(y))\fbox{\slttH]})}
251 \vspace*{2ex}
254 On a color display screen the unbalanced parentheses are bright purple.
257 \vspace*{2ex}
259 Syntactic highlighting simplifies detection of unbalanced\\
260 quotation marks.
262 {\tt tmp <- f(x, {\slttH"this is a string, y, z)}}
266 \newpage
268 {\bf inferior-ess-mode.} Evaluating lines of S source
270 Program statements and function definitions
271 can be developed in an editing window that is
272 NOT the same as the executing S process.
274 The lines are sent to S with keyboard
275 commands.
278 \hlinefill
279 \begin{verbatim}
281 lm( y ~ x, data=mydata)
282 \end{verbatim}
283 \begin{slverbatim}
284 --**-Emacs: test.s (ESS[S] [none])--L1--All------
285 \end{slverbatim}
286 \begin{verbatim}
287 > lm( y ~ x, data=mydata)
288 Error: Object "mydata" not found
289 Dumped
291 \end{verbatim}
292 \begin{slverbatim}
293 --**-Emacs: *S+3:1* (iESS [S+3:1]: run)--L6--All--
295 \end{slverbatim}
296 \hlinefill
299 Errors are corrected in the editing window and resent.
300 \newpage
301 Errors are corrected in the editing window and resent.
303 \hlinefill
305 \begin{verbatim}
307 lm( y ~ x, data=myrealdata)
308 \end{verbatim}
309 \begin{slverbatim}
310 --**-Emacs: test.s (ESS[S] [none])--L1--All------
311 \end{slverbatim}
312 \begin{verbatim}
313 > lm( y ~ x, data=mydata)
314 Error: Object "mydata" not found
315 Dumped
316 > lm( y ~ x, data=myrealdata)
317 \end{verbatim}
318 \begin{slverbatim}
320 --**-Emacs: *S+3:1* (iESS [S+3:1]: run)--L6--All--
321 \end{slverbatim}
322 \hlinefill
324 The corrected {\tt test.s} is now a permanent record of the
325 commands that are needed.
327 This form of interaction between the editing process and the S
328 execution is usually the best way to develop a set of functions.
330 \newpage
331 {\bf inferior-ess-mode.} The session file is always available.
333 The entire S session is in a buffer and can be be searched, edited,
334 reviewed, saved during the current session. Previous results never
335 run off the top of the screen and are never subject to arbitrary line
336 restrictions.
338 The buffer containing the S session transcript can be saved as a file.
339 The file can be revisited later for editing into a report or handout.
340 The file can be brought back into a buffer in S-transcript-mode and used as
341 the base for further development.
343 \newpage
344 {\bf S-transcript-mode.} The transcript of a previous S session can
345 be brought back and used as model for further development. When the
346 cursor is placed on any line of a multi-line command, the entire
347 command can be sent over
348 to any relevant active inferior S-process with a single keystroke.
350 \begin{verbatim}
351 > xyplot(data ~ voltage | power, data=time.powers,
352 + scales=list(y=list(relation="free")),
353 + ylab="powers of time",
354 + main="case0802 ladder of powers")
356 \end{verbatim}
358 Once the command works correctly, it can be cleaned mechanically with
359 the {\tt ess-transcript-clean-region} function.
361 \begin{verbatim}
362 xyplot(data ~ voltage | power, data=time.powers,
363 scales=list(y=list(relation="free")),
364 ylab="powers of time",
365 main="case0802 ladder of powers")
366 \end{verbatim}
368 \newpage
369 \item
370 Other features in ESS-mode
372 \begin{itemize}
373 \item Help files go to their own buffer. Many can be viewed simultaneously.
374 \item Several different instantiations of the same or different dialects of S (or other
375 statistical program) can be controlled simultaneously through the same emacs process.
376 \item Multiple S source files can be developed simultaneously.
377 \item ESS-mode recognizes functions, multi-line statements,
378 highlighted regions, parenthetical expressions.
379 \item When an error is detected in a source file, ESS switches the display to the file and
380 places the cursor on the line where the error was detected.
381 \item Object-name-completion.
382 \item Menu access.
383 \end{itemize}
385 \end{itemize}
386 \end{document}