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