| Line 12... |
Line 12... |
| 12 |
</head>
|
12 |
</head>
|
| 13 |
|
13 |
|
| 14 |
<body>
|
14 |
<body>
|
| 15 |
<h1>R FAQ</h1>
|
15 |
<h1>R FAQ</h1>
|
| 16 |
<h2>Frequently Asked Questions on R</h2>
|
16 |
<h2>Frequently Asked Questions on R</h2>
|
| 17 |
<h2>Version 0.90-2, 1999/11/25</h2>
|
17 |
<h2>Version 0.90-4, 1999/11/13</h2>
|
| 18 |
<address>Kurt Hornik</address>
|
18 |
<address>Kurt Hornik</address>
|
| 19 |
<p><p><hr><p>
|
19 |
<p><p><hr><p>
|
| 20 |
|
20 |
|
| 21 |
|
21 |
|
| 22 |
<h1>Table of Contents</h1>
|
22 |
<h1>Table of Contents</h1>
|
| Line 48... |
Line 48... |
| 48 |
<li><a href="#What%20is%20CRAN%3f">2.10 What is CRAN?</a>
|
48 |
<li><a href="#What%20is%20CRAN%3f">2.10 What is CRAN?</a>
|
| 49 |
</ul>
|
49 |
</ul>
|
| 50 |
<li><a href="#R%20and%20S">3 R and S</a>
|
50 |
<li><a href="#R%20and%20S">3 R and S</a>
|
| 51 |
<ul>
|
51 |
<ul>
|
| 52 |
<li><a href="#What%20is%20S%3f">3.1 What is S?</a>
|
52 |
<li><a href="#What%20is%20S%3f">3.1 What is S?</a>
|
| 53 |
<li><a href="#What%20is%20S-PLUS%3f">3.2 What is S-PLUS?</a>
|
53 |
<li><a href="#What%20is%20S-PLUS%3f">3.2 What is <small>S-PLUS</small>?</a>
|
| 54 |
<li><a href="#What%20are%20the%20differences%20between%20R%20and%20S%3f">3.3 What are the differences between R and S?</a>
|
54 |
<li><a href="#What%20are%20the%20differences%20between%20R%20and%20S%3f">3.3 What are the differences between R and S?</a>
|
| 55 |
<ul>
|
55 |
<ul>
|
| 56 |
<li><a href="#Lexical%20scoping">3.3.1 Lexical scoping</a>
|
56 |
<li><a href="#Lexical%20scoping">3.3.1 Lexical scoping</a>
|
| 57 |
<li><a href="#Models">3.3.2 Models</a>
|
57 |
<li><a href="#Models">3.3.2 Models</a>
|
| 58 |
<li><a href="#Others">3.3.3 Others</a>
|
58 |
<li><a href="#Others">3.3.3 Others</a>
|
| 59 |
</ul>
|
59 |
</ul>
|
| 60 |
<li><a href="#Is%20there%20anything%20R%20can%20do%20that%20S-PLUS%20cannot%3f">3.4 Is there anything R can do that S-PLUS cannot?</a>
|
60 |
<li><a href="#Is%20there%20anything%20R%20can%20do%20that%20S-PLUS%20cannot%3f">3.4 Is there anything R can do that <small>S-PLUS</small> cannot?</a>
|
| 61 |
</ul>
|
61 |
</ul>
|
| 62 |
<li><a href="#R%20Web%20Interfaces">4 R Web Interfaces</a>
|
62 |
<li><a href="#R%20Web%20Interfaces">4 R Web Interfaces</a>
|
| 63 |
<li><a href="#R%20Add-On%20Packages">5 R Add-On Packages</a>
|
63 |
<li><a href="#R%20Add-On%20Packages">5 R Add-On Packages</a>
|
| 64 |
<ul>
|
64 |
<ul>
|
| 65 |
<li><a href="#Which%20add-on%20packages%20exist%20for%20R%3f">5.1 Which add-on packages exist for R?</a>
|
65 |
<li><a href="#Which%20add-on%20packages%20exist%20for%20R%3f">5.1 Which add-on packages exist for R?</a>
|
| Line 71... |
Line 71... |
| 71 |
</ul>
|
71 |
</ul>
|
| 72 |
<li><a href="#R%20and%20Emacs">6 R and Emacs</a>
|
72 |
<li><a href="#R%20and%20Emacs">6 R and Emacs</a>
|
| 73 |
<ul>
|
73 |
<ul>
|
| 74 |
<li><a href="#Is%20there%20Emacs%20support%20for%20R%3f">6.1 Is there Emacs support for R?</a>
|
74 |
<li><a href="#Is%20there%20Emacs%20support%20for%20R%3f">6.1 Is there Emacs support for R?</a>
|
| 75 |
<li><a href="#Should%20I%20run%20R%20from%20within%20Emacs%3f">6.2 Should I run R from within Emacs?</a>
|
75 |
<li><a href="#Should%20I%20run%20R%20from%20within%20Emacs%3f">6.2 Should I run R from within Emacs?</a>
|
| - |
|
76 |
<li><a href="#Debugging%20R%20from%20within%20Emacs">6.3 Debugging R from within Emacs</a>
|
| 76 |
</ul>
|
77 |
</ul>
|
| 77 |
<li><a href="#R%20Miscellania">7 R Miscellania</a>
|
78 |
<li><a href="#R%20Miscellania">7 R Miscellania</a>
|
| 78 |
<ul>
|
79 |
<ul>
|
| 79 |
<li><a href="#Why%20does%20R%20run%20out%20of%20memory%3f">7.1 Why does R run out of memory?</a>
|
80 |
<li><a href="#Why%20does%20R%20run%20out%20of%20memory%3f">7.1 Why does R run out of memory?</a>
|
| 80 |
<li><a href="#Why%20does%20sourcing%20a%20correct%20file%20fail%3f">7.2 Why does sourcing a correct file fail?</a>
|
81 |
<li><a href="#Why%20does%20sourcing%20a%20correct%20file%20fail%3f">7.2 Why does sourcing a correct file fail?</a>
|
| Line 185... |
Line 186... |
| 185 |
</pre>
|
186 |
</pre>
|
| 186 |
|
187 |
|
| 187 |
<p>From there, you can obtain versions converted to
|
188 |
<p>From there, you can obtain versions converted to
|
| 188 |
<a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.txt">plain ASCII text</a>, <a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.dvi.gz">DVI</a>,
|
189 |
<a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.txt">plain ASCII text</a>, <a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.dvi.gz">DVI</a>,
|
| 189 |
<a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.info.gz">GNU info</a>,
|
190 |
<a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.info.gz">GNU info</a>,
|
| 190 |
<a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html">HTML</a>,
|
191 |
<a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html"><small>HTML</small></a>,
|
| 191 |
<a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.pdf">PDF</a>,
|
192 |
<a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.pdf">PDF</a>,
|
| 192 |
<a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.ps.gz">PostScript</a> as
|
193 |
<a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.ps.gz">PostScript</a> as
|
| 193 |
well as the <a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.texi">Texinfo source</a> used for creating all these formats using the
|
194 |
well as the <a href="http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.texi">Texinfo source</a> used for creating all these formats using the
|
| 194 |
<a href="http://texinfo.org/">GNU Texinfo system</a>.
|
195 |
<a href="http://texinfo.org/">GNU Texinfo system</a>.
|
| 195 |
|
196 |
|
| Line 323... |
Line 324... |
| 323 |
Up:<a rel=up href="#R%20Basics">R Basics</a>
|
324 |
Up:<a rel=up href="#R%20Basics">R Basics</a>
|
| 324 |
<br>
|
325 |
<br>
|
| 325 |
|
326 |
|
| 326 |
<h2>2.3 What is the current version of R?</h2>
|
327 |
<h2>2.3 What is the current version of R?</h2>
|
| 327 |
|
328 |
|
| 328 |
<p>The current stable Unix/Windows version is 0.90.0, the
|
329 |
<p>The current stable Unix/Windows version is 0.90.1, the
|
| 329 |
unstable one is 0.99.0. Typically, new features are
|
330 |
unstable one is 0.99.0. Typically, new features are
|
| 330 |
introduced in the development versions; updates of stable versions are
|
331 |
introduced in the development versions; updates of stable versions are
|
| 331 |
for bug fixes mostly. The version for the Mac is pre-alpha.
|
332 |
for bug fixes mostly. The version for the Mac is pre-alpha.
|
| 332 |
|
333 |
|
| 333 |
<p><hr>
|
334 |
<p><hr>
|
| Line 371... |
Line 372... |
| 371 |
|
372 |
|
| 372 |
<p>Otherwise, you can compile and install R yourself, which can be done
|
373 |
<p>Otherwise, you can compile and install R yourself, which can be done
|
| 373 |
very easily under a number of common Unix platforms (see <a href="#What%20machines%20does%20R%20run%20on%3f">What machines does R run on?</a>). The file <code>INSTALL</code> that comes with the
|
374 |
very easily under a number of common Unix platforms (see <a href="#What%20machines%20does%20R%20run%20on%3f">What machines does R run on?</a>). The file <code>INSTALL</code> that comes with the
|
| 374 |
R distribution contains instructions.
|
375 |
R distribution contains instructions.
|
| 375 |
|
376 |
|
| 376 |
<p>Note that you need a FORTRAN compiler or <code>f2c</code> in addition to a C
|
377 |
<p>Note that you need a <small>FORTRAN</small> compiler or <code>f2c</code> in addition to a
|
| 377 |
compiler to build R. Also, you need Perl version 5 to build the
|
378 |
C compiler to build R. Also, you need Perl version 5 to build the
|
| 378 |
documentation. If this is not available on your system, you can obtain
|
379 |
documentation. If this is not available on your system, you can obtain
|
| 379 |
precompiled documentation files via CRAN.
|
380 |
precompiled documentation files via CRAN.
|
| 380 |
|
381 |
|
| 381 |
<p>In the simplest case, untar the R source code, cd to the directory thus
|
382 |
<p>In the simplest case, untar the R source code, cd to the directory thus
|
| 382 |
created, and issue the following commands (at the shell prompt):
|
383 |
created, and issue the following commands (at the shell prompt):
|
| Line 387... |
Line 388... |
| 387 |
|
388 |
|
| 388 |
<p>If these commands execute successfully, the R binary and a shell script
|
389 |
<p>If these commands execute successfully, the R binary and a shell script
|
| 389 |
font-end called <code>R</code> are created and copied to the <code>bin</code>
|
390 |
font-end called <code>R</code> are created and copied to the <code>bin</code>
|
| 390 |
directory. You can copy the script to a place where users can invoke
|
391 |
directory. You can copy the script to a place where users can invoke
|
| 391 |
it, for example to <code>/usr/local/bin</code>. In addition, plain text help
|
392 |
it, for example to <code>/usr/local/bin</code>. In addition, plain text help
|
| 392 |
pages as well as HTML and LaTeX versions of the documentation are
|
393 |
pages as well as <small>HTML</small> and LaTeX versions of the documentation are
|
| 393 |
built.
|
394 |
built.
|
| 394 |
|
395 |
|
| 395 |
<p>Use <kbd>make dvi</kbd> to obtain a dvi version of the R manual. This
|
396 |
<p>Use <kbd>make dvi</kbd> to obtain a dvi version of the R manual. This
|
| 396 |
creates the files <code>Manual.dvi</code> (a start of a manual) and
|
397 |
creates the files <code>Manual.dvi</code> (a start of a manual) and
|
| 397 |
<code>Reference.dvi</code> (an R object reference index) in the
|
398 |
<code>Reference.dvi</code> (an R object reference index) in the
|
| Line 469... |
Line 470... |
| 469 |
|
470 |
|
| 470 |
<p>The <code>bin/linux</code> directory contains Debian 2.1 packages for the i386
|
471 |
<p>The <code>bin/linux</code> directory contains Debian 2.1 packages for the i386
|
| 471 |
platform (now part of the Debian distribution and maintained by Doug
|
472 |
platform (now part of the Debian distribution and maintained by Doug
|
| 472 |
Bates) as well as Red Hat 5.1 packages for the alpha and sparc platforms
|
473 |
Bates) as well as Red Hat 5.1 packages for the alpha and sparc platforms
|
| 473 |
(maintained by Nassib Nasser and Vin Everett, respectively), Red Hat 6.0
|
474 |
(maintained by Nassib Nasser and Vin Everett, respectively), Red Hat 6.0
|
| 474 |
packages for the i386 and alpha platforms (maintained by Martyn Plummer
|
475 |
packages for the i386, alpha and sparc platforms (maintained by Martyn
|
| 475 |
and Naoki Takebayashi, respectively), S.u.S.E. 5.3/6.0/6.2 i386 packages
|
476 |
Plummer, Naoki Takebayashi, and Vin Everett, respectively),
|
| - |
|
477 |
S.u.S.E. 5.3/6.0/6.2 i386 packages by Albrecht Gebhardt, and RPMs for
|
| 476 |
by Albrecht Gebhardt, and RPMs for the ppc platform by Alex Buerkle.
|
478 |
the ppc platform by Alex Buerkle.
|
| 477 |
|
479 |
|
| 478 |
<p>The <code>bin/osf</code> directory contains RPMs for alpha systems running
|
480 |
<p>The <code>bin/osf</code> directory contains RPMs for alpha systems running
|
| 479 |
Digital Unix 4.0 by Albrecht Gebhardt.
|
481 |
Digital Unix 4.0 by Albrecht Gebhardt.
|
| 480 |
|
482 |
|
| 481 |
<p>No other binary distributions have thus far been made publically
|
483 |
<p>No other binary distributions have thus far been made publically
|
| Line 495... |
Line 497... |
| 495 |
(or <kbd>?<var>name</var></kbd>) at the R prompt, where <var>name</var> is the name of
|
497 |
(or <kbd>?<var>name</var></kbd>) at the R prompt, where <var>name</var> is the name of
|
| 496 |
the topic help is sought for. (In the case of unary and binary
|
498 |
the topic help is sought for. (In the case of unary and binary
|
| 497 |
operators and control-flow special forms, the name may need to be be
|
499 |
operators and control-flow special forms, the name may need to be be
|
| 498 |
quoted.)
|
500 |
quoted.)
|
| 499 |
|
501 |
|
| 500 |
<p>This documentation can also be made available as HTML, and as hardcopy
|
502 |
<p>This documentation can also be made available as <small>HTML</small>, and as
|
| 501 |
via LaTeX, see <a href="#How%20can%20R%20be%20installed%3f">How can R be installed?</a>. An up-to-date HTML
|
503 |
hardcopy via LaTeX, see <a href="#How%20can%20R%20be%20installed%3f">How can R be installed?</a>. An up-to-date
|
| 502 |
version is always available for web browsing at
|
504 |
<small>HTML</small> version is always available for web browsing at
|
| 503 |
<a href="http://stat.ethz.ch/R/manual/">http://stat.ethz.ch/R/manual/</a>.
|
505 |
<a href="http://stat.ethz.ch/R/manual/">http://stat.ethz.ch/R/manual/</a>.
|
| 504 |
|
506 |
|
| 505 |
<p>An earlier attempt at an R manual ("Notes on R: A Programming
|
507 |
<p>An earlier attempt at an R manual ("Notes on R: A Programming
|
| 506 |
Environment for Data Analysis and Graphics"), based on the "Notes on
|
508 |
Environment for Data Analysis and Graphics"), based on the "Notes on
|
| 507 |
S-PLUS" by <a href="mailto:venables@stats.adelaide.edu.au">Bill Venables</a> and
|
509 |
<small>S-PLUS</small>" by <a href="mailto:venables@stats.adelaide.edu.au">Bill Venables</a> and
|
| 508 |
<a href="mailto:D.M.Smith@lancaster.ac.uk">David Smith</a>, can be obtained as
|
510 |
<a href="mailto:D.M.Smith@lancaster.ac.uk">David Smith</a>, can be obtained as
|
| 509 |
<code>Rnotes.tgz</code> (LaTeX source) in a CRAN <code>doc</code> directory.
|
511 |
<code>Rnotes.tgz</code> (LaTeX source) in a CRAN <code>doc</code> directory.
|
| 510 |
Further documentation on R and the R API are currently being written.
|
512 |
Further documentation on R and the R API are currently being written.
|
| 511 |
|
513 |
|
| 512 |
<p>In the absence of an R manual, documentation for S/S-PLUS (see <a href="#R%20and%20S">R and S</a>) can be used in combination with this FAQ (see <a href="#What%20are%20the%20differences%20between%20R%20and%20S%3f">What are the differences between R and S?</a>). We recommend
|
514 |
<p>In the absence of an R manual, documentation for S/<small>S-PLUS</small> (see <a href="#R%20and%20S">R and S</a>) can be used in combination with this FAQ (see <a href="#What%20are%20the%20differences%20between%20R%20and%20S%3f">What are the differences between R and S?</a>). We recommend
|
| 513 |
|
515 |
|
| 514 |
<blockquote>
|
516 |
<blockquote>
|
| 515 |
W. N. Venables and B. D. Ripley (1999), "Modern Applied Statistics with
|
517 |
W. N. Venables and B. D. Ripley (1999), "Modern Applied Statistics with
|
| 516 |
S-PLUS. Third Edition". Springer, ISBN 0-387-98825-4.
|
518 |
<small>S-PLUS</small>. Third Edition". Springer, ISBN 0-387-98825-4.
|
| 517 |
</blockquote>
|
519 |
</blockquote>
|
| 518 |
|
520 |
|
| 519 |
<p>which has a home page at <a href="http://www.stats.ox.ac.uk/pub/MASS3/">http://www.stats.ox.ac.uk/pub/MASS3/</a>
|
521 |
<p>which has a home page at <a href="http://www.stats.ox.ac.uk/pub/MASS3/">http://www.stats.ox.ac.uk/pub/MASS3/</a>
|
| 520 |
providing additional material, in particular "R Complements" which
|
522 |
providing additional material, in particular "R Complements" which
|
| 521 |
describe how to use the book with R. These complements provide both
|
523 |
describe how to use the book with R. These complements provide both
|
| 522 |
descriptions of some of the differences between R and S-PLUS, and the
|
524 |
descriptions of some of the differences between R and <small>S-PLUS</small>, and the
|
| 523 |
modifications needed to run the examples in the book. Its companion
|
525 |
modifications needed to run the examples in the book. Its companion
|
| 524 |
volume on "S Programming", due in about April 2000, will provide an
|
526 |
volume on "S Programming", due in about April 2000, will provide an
|
| 525 |
in-depth guide to writing software in the S language which forms the
|
527 |
in-depth guide to writing software in the S language which forms the
|
| 526 |
basis of both the commercial S-PLUS and the Open Source R data analysis
|
528 |
basis of both the commercial <small>S-PLUS</small> and the Open Source R data
|
| 527 |
software systems.
|
529 |
analysis software systems.
|
| 528 |
|
530 |
|
| 529 |
<p>More introductory books are
|
531 |
<p>More introductory books are
|
| 530 |
|
532 |
|
| 531 |
<blockquote>
|
533 |
<blockquote>
|
| 532 |
P. Spector (1994), "An introduction to S and S-PLUS", Duxbury Press.
|
534 |
P. Spector (1994), "An introduction to S and <small>S-PLUS</small>", Duxbury Press.
|
| 533 |
|
535 |
|
| 534 |
<p>A. Krause and M. Olsen (1997), "The Basics of S and S-PLUS", Springer.
|
536 |
<p>A. Krause and M. Olsen (1997), "The Basics of S and <small>S-PLUS</small>",
|
| - |
|
537 |
Springer.
|
| 535 |
</blockquote>
|
538 |
</blockquote>
|
| 536 |
|
539 |
|
| 537 |
<p>Last, but not least, Ross' and Robert's experience in designing and
|
540 |
<p>Last, but not least, Ross' and Robert's experience in designing and
|
| 538 |
implementing R is described in:
|
541 |
implementing R is described in:
|
| 539 |
|
542 |
|
| Line 583... |
Line 586... |
| 583 |
the development of R.
|
586 |
the development of R.
|
| 584 |
<br><dt><code>r-help</code>
|
587 |
<br><dt><code>r-help</code>
|
| 585 |
<dd>The `main' R mailing list, for announcements about the development of R
|
588 |
<dd>The `main' R mailing list, for announcements about the development of R
|
| 586 |
and the availability of new code, questions and answers about problems
|
589 |
and the availability of new code, questions and answers about problems
|
| 587 |
and solutions using R, enhancements and patches to the source code and
|
590 |
and solutions using R, enhancements and patches to the source code and
|
| 588 |
documentation of R, comparison and compatibility with S and S-PLUS, and
|
591 |
documentation of R, comparison and compatibility with S and <small>S-PLUS</small>,
|
| 589 |
for the posting of nice examples and benchmarks.
|
592 |
and for the posting of nice examples and benchmarks.
|
| 590 |
</dl>
|
593 |
</dl>
|
| 591 |
|
594 |
|
| 592 |
<p>Note that the r-announce list is gatewayed into r-help, so you don't
|
595 |
<p>Note that the r-announce list is gatewayed into r-help, so you don't
|
| 593 |
need to subscribe to both of them.
|
596 |
need to subscribe to both of them.
|
| 594 |
|
597 |
|
| Line 745... |
Line 748... |
| 745 |
Next:<a rel=next href="#What%20are%20the%20differences%20between%20R%20and%20S%3f">What are the differences between R and S?</a>,
|
748 |
Next:<a rel=next href="#What%20are%20the%20differences%20between%20R%20and%20S%3f">What are the differences between R and S?</a>,
|
| 746 |
Previous:<a rel=previous href="#What%20is%20S%3f">What is S?</a>,
|
749 |
Previous:<a rel=previous href="#What%20is%20S%3f">What is S?</a>,
|
| 747 |
Up:<a rel=up href="#R%20and%20S">R and S</a>
|
750 |
Up:<a rel=up href="#R%20and%20S">R and S</a>
|
| 748 |
<br>
|
751 |
<br>
|
| 749 |
|
752 |
|
| 750 |
<h2>3.2 What is S-PLUS?</h2>
|
753 |
<h2>3.2 What is <small>S-PLUS</small>?</h2>
|
| 751 |
|
754 |
|
| 752 |
<p>S-PLUS is a value-added version of S sold by Statistical Sciences,
|
755 |
<p><small>S-PLUS</small> is a value-added version of S sold by Statistical Sciences,
|
| 753 |
Inc. (now a division of Mathsoft, Inc.). Based on the S language,
|
756 |
Inc. (now a division of Mathsoft, Inc.). Based on the S language,
|
| 754 |
S-PLUS provides functionality in a wide variety of areas, including
|
757 |
<small>S-PLUS</small> provides functionality in a wide variety of areas, including
|
| 755 |
robust regression, modern non-parametric regression, time series,
|
758 |
robust regression, modern non-parametric regression, time series,
|
| 756 |
survival analysis, multivariate analysis, classical statistical tests,
|
759 |
survival analysis, multivariate analysis, classical statistical tests,
|
| 757 |
quality control, and graphics drivers. Add-on modules add additional
|
760 |
quality control, and graphics drivers. Add-on modules add additional
|
| 758 |
capabilities for wavelet analysis, spatial statistics, GARCH models, and
|
761 |
capabilities for wavelet analysis, spatial statistics, GARCH models, and
|
| 759 |
design of experiments.
|
762 |
design of experiments.
|
| 760 |
|
763 |
|
| 761 |
<p>See the <a href="http://www.mathsoft.com/splus/">MathSoft S-PLUS page</a> for
|
764 |
<p>See the <a href="http://www.mathsoft.com/splus/">MathSoft <small>S-PLUS</small> page</a>
|
| 762 |
further information.
|
765 |
for further information.
|
| 763 |
|
766 |
|
| 764 |
<p><hr>
|
767 |
<p><hr>
|
| 765 |
Node:<a name="What%20are%20the%20differences%20between%20R%20and%20S%3f">What are the differences between R and S?</a>,
|
768 |
Node:<a name="What%20are%20the%20differences%20between%20R%20and%20S%3f">What are the differences between R and S?</a>,
|
| 766 |
Next:<a rel=next href="#Is%20there%20anything%20R%20can%20do%20that%20S-PLUS%20cannot%3f">Is there anything R can do that S-PLUS cannot?</a>,
|
769 |
Next:<a rel=next href="#Is%20there%20anything%20R%20can%20do%20that%20S-PLUS%20cannot%3f">Is there anything R can do that S-PLUS cannot?</a>,
|
| 767 |
Previous:<a rel=previous href="#What%20is%20S-PLUS%3f">What is S-PLUS?</a>,
|
770 |
Previous:<a rel=previous href="#What%20is%20S-PLUS%3f">What is S-PLUS?</a>,
|
| Line 829... |
Line 832... |
| 829 |
statistic from a sample of size n from a (continuous) distribution.
|
832 |
statistic from a sample of size n from a (continuous) distribution.
|
| 830 |
For simplicity, we shall use both the cdf and pdf of the distribution
|
833 |
For simplicity, we shall use both the cdf and pdf of the distribution
|
| 831 |
as explicit arguments. (Example compiled from various postings by Luke
|
834 |
as explicit arguments. (Example compiled from various postings by Luke
|
| 832 |
Tierney.)
|
835 |
Tierney.)
|
| 833 |
|
836 |
|
| 834 |
<p>The S-PLUS documentation for <code>call()</code> basically suggests the
|
837 |
<p>The <small>S-PLUS</small> documentation for <code>call()</code> basically suggests the
|
| 835 |
following:
|
838 |
following:
|
| 836 |
|
839 |
|
| 837 |
<pre>dorder <- function(n, r, pfun, dfun) {
|
840 |
<pre>dorder <- function(n, r, pfun, dfun) {
|
| 838 |
f <- function(x) NULL
|
841 |
f <- function(x) NULL
|
| 839 |
con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
|
842 |
con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
|
| Line 1068... |
Line 1071... |
| 1068 |
|
1071 |
|
| 1069 |
<li>R passes integer objects to C as <code>int *</code> rather than <code>long *</code>
|
1072 |
<li>R passes integer objects to C as <code>int *</code> rather than <code>long *</code>
|
| 1070 |
as in S.
|
1073 |
as in S.
|
| 1071 |
|
1074 |
|
| 1072 |
<li>R has no single precision storage mode. However, as of version 0.65.1,
|
1075 |
<li>R has no single precision storage mode. However, as of version 0.65.1,
|
| 1073 |
there is a single precision interface to C/FORTRAN subroutines.
|
1076 |
there is a single precision interface to C/<small>FORTRAN</small> subroutines.
|
| 1074 |
|
1077 |
|
| 1075 |
<li>By default, <code>ls()</code> returns the names of the objects in the current
|
1078 |
<li>By default, <code>ls()</code> returns the names of the objects in the current
|
| 1076 |
(under R) and global (under S) environment, respectively. For example,
|
1079 |
(under R) and global (under S) environment, respectively. For example,
|
| 1077 |
given
|
1080 |
given
|
| 1078 |
|
1081 |
|
| Line 1138... |
Line 1141... |
| 1138 |
Node:<a name="Is%20there%20anything%20R%20can%20do%20that%20S-PLUS%20cannot%3f">Is there anything R can do that S-PLUS cannot?</a>,
|
1141 |
Node:<a name="Is%20there%20anything%20R%20can%20do%20that%20S-PLUS%20cannot%3f">Is there anything R can do that S-PLUS cannot?</a>,
|
| 1139 |
Previous:<a rel=previous href="#What%20are%20the%20differences%20between%20R%20and%20S%3f">What are the differences between R and S?</a>,
|
1142 |
Previous:<a rel=previous href="#What%20are%20the%20differences%20between%20R%20and%20S%3f">What are the differences between R and S?</a>,
|
| 1140 |
Up:<a rel=up href="#R%20and%20S">R and S</a>
|
1143 |
Up:<a rel=up href="#R%20and%20S">R and S</a>
|
| 1141 |
<br>
|
1144 |
<br>
|
| 1142 |
|
1145 |
|
| 1143 |
<h2>3.4 Is there anything R can do that S-PLUS cannot?</h2>
|
1146 |
<h2>3.4 Is there anything R can do that <small>S-PLUS</small> cannot?</h2>
|
| 1144 |
|
1147 |
|
| 1145 |
<p>Since almost anything you can do in R has source code that you could
|
1148 |
<p>Since almost anything you can do in R has source code that you could
|
| 1146 |
port to S-PLUS with little effort there will never be much you can do in
|
1149 |
port to <small>S-PLUS</small> with little effort there will never be much you can do
|
| 1147 |
R that you couldn't do in S-PLUS if you wanted to. (Note that using
|
1150 |
in R that you couldn't do in <small>S-PLUS</small> if you wanted to. (Note that
|
| 1148 |
lexical scoping may simplify matters considerably, though.)
|
1151 |
using lexical scoping may simplify matters considerably, though.)
|
| 1149 |
|
1152 |
|
| 1150 |
<p>R offers several graphics features that S-PLUS does not, such as finer
|
1153 |
<p>R offers several graphics features that <small>S-PLUS</small> does not, such as finer
|
| 1151 |
handling of line types, more convenient color handling (via palettes),
|
1154 |
handling of line types, more convenient color handling (via palettes),
|
| 1152 |
gamma correction for color, and, most importantly, mathematical
|
1155 |
gamma correction for color, and, most importantly, mathematical
|
| 1153 |
annotation in plot texts, via input expressions reminiscent of TeX
|
1156 |
annotation in plot texts, via input expressions reminiscent of TeX
|
| 1154 |
constructs. Unfortunately, this feature still is mostly undocumented.
|
1157 |
constructs. Unfortunately, this feature still is mostly undocumented.
|
| 1155 |
The paper "An Approach to Providing Mathematical Annotation in Plots"
|
1158 |
The paper "An Approach to Providing Mathematical Annotation in Plots"
|
| Line 1249... |
Line 1252... |
| 1249 |
<dt><strong>KernSmooth</strong>
|
1252 |
<dt><strong>KernSmooth</strong>
|
| 1250 |
<dd>Functions for kernel smoothing (and density estimation) corresponding to
|
1253 |
<dd>Functions for kernel smoothing (and density estimation) corresponding to
|
| 1251 |
the book "Kernel Smoothing" by M. P. Wand and M. C. Jones, 1995.
|
1254 |
the book "Kernel Smoothing" by M. P. Wand and M. C. Jones, 1995.
|
| 1252 |
<br><dt><strong>MASS</strong>
|
1255 |
<br><dt><strong>MASS</strong>
|
| 1253 |
<dd>Functions and datasets from the main library of Venables and Ripley,
|
1256 |
<dd>Functions and datasets from the main library of Venables and Ripley,
|
| 1254 |
"Modern Applied Statistics with S-PLUS". Contained in <code>VR</code>.
|
1257 |
"Modern Applied Statistics with <small>S-PLUS</small>". Contained in <code>VR</code>.
|
| 1255 |
<br><dt><strong>NISTnls</strong>
|
1258 |
<br><dt><strong>NISTnls</strong>
|
| 1256 |
<dd>A set of test nonlinear least squares examples from NIST, the
|
1259 |
<dd>A set of test nonlinear least squares examples from NIST, the
|
| 1257 |
U.S. National Institute for Standards and Technology.
|
1260 |
U.S. National Institute for Standards and Technology.
|
| 1258 |
<br><dt><strong>RmSQL</strong>
|
1261 |
<br><dt><strong>RmSQL</strong>
|
| 1259 |
<dd>An interface between R and the mSQL database system.
|
1262 |
<dd>An interface between R and the mSQL database system.
|
| Line 1380... |
Line 1383... |
| 1380 |
<dd>Recursive Partitioning.
|
1383 |
<dd>Recursive Partitioning.
|
| 1381 |
<br><dt><strong>sgeostat</strong>
|
1384 |
<br><dt><strong>sgeostat</strong>
|
| 1382 |
<dd>An object-oriented framework for geostatistical modeling.
|
1385 |
<dd>An object-oriented framework for geostatistical modeling.
|
| 1383 |
<br><dt><strong>sm</strong>
|
1386 |
<br><dt><strong>sm</strong>
|
| 1384 |
<dd>Software linked to the book "Applied Smoothing Techniques for Data
|
1387 |
<dd>Software linked to the book "Applied Smoothing Techniques for Data
|
| 1385 |
Analysis: The Kernel Approach with S-PLUS Illustrations" by
|
1388 |
Analysis: The Kernel Approach with <small>S-PLUS</small> Illustrations" by
|
| 1386 |
A. W. Bowman and A. Azzalini (1997), Oxford University Press.
|
1389 |
A. W. Bowman and A. Azzalini (1997), Oxford University Press.
|
| 1387 |
<br><dt><strong>spatial</strong>
|
1390 |
<br><dt><strong>spatial</strong>
|
| 1388 |
<dd>Functions for kriging and point pattern analysis from "Modern Applied
|
1391 |
<dd>Functions for kriging and point pattern analysis from "Modern Applied
|
| 1389 |
Statistics with S-PLUS" by W. Venables and B. Ripley. Contained in
|
1392 |
Statistics with <small>S-PLUS</small>" by W. Venables and B. Ripley. Contained in
|
| 1390 |
<code>VR</code>.
|
1393 |
<code>VR</code>.
|
| 1391 |
<br><dt><strong>stable</strong>
|
1394 |
<br><dt><strong>stable</strong>
|
| 1392 |
<dd>Density, distribution, quantile and hazard functions of a stable
|
1395 |
<dd>Density, distribution, quantile and hazard functions of a stable
|
| 1393 |
variate; generalized linear models for the parameters of a stable
|
1396 |
variate; generalized linear models for the parameters of a stable
|
| 1394 |
distribution.
|
1397 |
distribution.
|
| Line 1450... |
Line 1453... |
| 1450 |
models, and numerical differentiation. It also contains Troll models as
|
1453 |
models, and numerical differentiation. It also contains Troll models as
|
| 1451 |
another class (the Troll interface is not yet functional in R). Paul's
|
1454 |
another class (the Troll interface is not yet functional in R). Paul's
|
| 1452 |
package <strong>dse</strong> can be obtained via
|
1455 |
package <strong>dse</strong> can be obtained via
|
| 1453 |
<a href="http://www.bank-banque-canada.ca/pgilbert/dsedesc.htm">http://www.bank-banque-canada.ca/pgilbert/dsedesc.htm</a>.
|
1456 |
<a href="http://www.bank-banque-canada.ca/pgilbert/dsedesc.htm">http://www.bank-banque-canada.ca/pgilbert/dsedesc.htm</a>.
|
| 1454 |
|
1457 |
|
| - |
|
1458 |
<a href="mailto:keitt@nceas.ucsb.edu">Timothy H. Keitt</a> has written
|
| - |
|
1459 |
<strong>RPgSQL</strong>, a package which allows users to read and write data
|
| - |
|
1460 |
frames to and from a PostgreSQL database (and also has a low-level
|
| - |
|
1461 |
interface for sending SQL queries to the PostgreSQL backend, and
|
| - |
|
1462 |
retrieving results), and can be obtained from
|
| - |
|
1463 |
<a href="http://www.nceas.ucsb.edu/~keitt/R/">http://www.nceas.ucsb.edu/~keitt/R/</a>. There is also the
|
| - |
|
1464 |
<strong>RODBC</strong> package by <a href="mailto:mlapsley@ndirect.co.uk">Michael Lapsley</a> which provides an R ODBC interface; see
|
| - |
|
1465 |
<a href="http://www.ndirect.co.uk/~mlapsley/">http://www.ndirect.co.uk/~mlapsley/</a> for more information.
|
| - |
|
1466 |
|
| 1455 |
<p>More code has been posted to the r-help mailing list, and can be
|
1467 |
<p>More code has been posted to the r-help mailing list, and can be
|
| 1456 |
obtained from the mailing list archive.
|
1468 |
obtained from the mailing list archive.
|
| 1457 |
|
1469 |
|
| 1458 |
<p><hr>
|
1470 |
<p><hr>
|
| 1459 |
Node:<a name="How%20can%20add-on%20packages%20be%20installed%3f">How can add-on packages be installed?</a>,
|
1471 |
Node:<a name="How%20can%20add-on%20packages%20be%20installed%3f">How can add-on packages be installed?</a>,
|
| Line 1640... |
Line 1652... |
| 1640 |
<p>The <code>man</code> subdirectory should contain documentation files for the
|
1652 |
<p>The <code>man</code> subdirectory should contain documentation files for the
|
| 1641 |
objects in the package. The documentation files to be installed must
|
1653 |
objects in the package. The documentation files to be installed must
|
| 1642 |
also start with a (lower- or uppercase) letter and have the extension
|
1654 |
also start with a (lower- or uppercase) letter and have the extension
|
| 1643 |
<code>.Rd</code> (the default) or <code>.rd</code>.
|
1655 |
<code>.Rd</code> (the default) or <code>.rd</code>.
|
| 1644 |
|
1656 |
|
| 1645 |
<p>C or FORTRAN source and optionally a <code>Makefile</code> for the compiled
|
1657 |
<p>C or <small>FORTRAN</small> source and optionally a <code>Makefile</code> for the compiled
|
| 1646 |
code is in <code>src</code>. Note that the <code>Makefile</code> most likely is not
|
1658 |
code is in <code>src</code>. Note that the <code>Makefile</code> most likely is not
|
| 1647 |
needed.
|
1659 |
needed.
|
| 1648 |
|
1660 |
|
| 1649 |
<p>The <code>data</code> subdirectory is for additional data files the package
|
1661 |
<p>The <code>data</code> subdirectory is for additional data files the package
|
| 1650 |
makes available for loading using <code>data()</code>. Currently, data files
|
1662 |
makes available for loading using <code>data()</code>. Currently, data files
|
| Line 1691... |
Line 1703... |
| 1691 |
<p>One place where functionality is still missing is the modeling software
|
1703 |
<p>One place where functionality is still missing is the modeling software
|
| 1692 |
as described in "Statistical Models in S" (see <a href="#What%20is%20S%3f">What is S?</a>);
|
1704 |
as described in "Statistical Models in S" (see <a href="#What%20is%20S%3f">What is S?</a>);
|
| 1693 |
Generalized Additive Models (<strong>gam</strong>) and some of the nonlinear
|
1705 |
Generalized Additive Models (<strong>gam</strong>) and some of the nonlinear
|
| 1694 |
modeling code are not there yet.
|
1706 |
modeling code are not there yet.
|
| 1695 |
|
1707 |
|
| 1696 |
<p>See also the <code>PROJECTS</code> file in the top level R source directory.
|
1708 |
<p>The <a href="http://developer.r-project.org">R Developer Page</a> acts as an
|
| - |
|
1709 |
intermediate repository for more or less finalized ideas and plans for
|
| - |
|
1710 |
the R statistical system. It contains (pointers to) TODO lists, RFCs,
|
| - |
|
1711 |
various other writeups, ideas lists, and CVS miscellania.
|
| 1697 |
|
1712 |
|
| 1698 |
<p>Many (more) of the packages available at the Statlib S Repository might
|
1713 |
<p>Many (more) of the packages available at the Statlib S Repository might
|
| 1699 |
be worth porting to R.
|
1714 |
be worth porting to R.
|
| 1700 |
|
1715 |
|
| 1701 |
<p>If you are interested in working on any of these projects, please notify
|
1716 |
<p>If you are interested in working on any of these projects, please notify
|
| Line 1711... |
Line 1726... |
| 1711 |
<h1>6 R and Emacs</h1>
|
1726 |
<h1>6 R and Emacs</h1>
|
| 1712 |
|
1727 |
|
| 1713 |
<ul>
|
1728 |
<ul>
|
| 1714 |
<li><a href="#Is%20there%20Emacs%20support%20for%20R%3f">Is there Emacs support for R?</a>:
|
1729 |
<li><a href="#Is%20there%20Emacs%20support%20for%20R%3f">Is there Emacs support for R?</a>:
|
| 1715 |
<li><a href="#Should%20I%20run%20R%20from%20within%20Emacs%3f">Should I run R from within Emacs?</a>:
|
1730 |
<li><a href="#Should%20I%20run%20R%20from%20within%20Emacs%3f">Should I run R from within Emacs?</a>:
|
| - |
|
1731 |
<li><a href="#Debugging%20R%20from%20within%20Emacs">Debugging R from within Emacs</a>:
|
| 1716 |
</ul>
|
1732 |
</ul>
|
| 1717 |
|
1733 |
|
| 1718 |
<p><hr>
|
1734 |
<p><hr>
|
| 1719 |
Node:<a name="Is%20there%20Emacs%20support%20for%20R%3f">Is there Emacs support for R?</a>,
|
1735 |
Node:<a name="Is%20there%20Emacs%20support%20for%20R%3f">Is there Emacs support for R?</a>,
|
| 1720 |
Next:<a rel=next href="#Should%20I%20run%20R%20from%20within%20Emacs%3f">Should I run R from within Emacs?</a>,
|
1736 |
Next:<a rel=next href="#Should%20I%20run%20R%20from%20within%20Emacs%3f">Should I run R from within Emacs?</a>,
|
| Line 1726... |
Line 1742... |
| 1726 |
|
1742 |
|
| 1727 |
<p>There is an Emacs package which provides a standard interface between
|
1743 |
<p>There is an Emacs package which provides a standard interface between
|
| 1728 |
statistical programs and statistical processes called ESS ("Emacs
|
1744 |
statistical programs and statistical processes called ESS ("Emacs
|
| 1729 |
Speaks Statistics"). It is intended to provide assistance for
|
1745 |
Speaks Statistics"). It is intended to provide assistance for
|
| 1730 |
interactive statistical programming and data analysis. Languages
|
1746 |
interactive statistical programming and data analysis. Languages
|
| 1731 |
supported include: S dialects (S 3/4, S-PLUS 3.x/4.x/5.x, and R),
|
1747 |
supported include: S dialects (S 3/4, <small>S-PLUS</small> 3.x/4.x/5.x, and R),
|
| 1732 |
LispStat dialects (XLispStat, ViSta), SAS, Stata, SPSS dialects (SPSS,
|
1748 |
LispStat dialects (XLispStat, ViSta), SAS, Stata, SPSS dialects (SPSS,
|
| 1733 |
Fiasco) and SCA.
|
1749 |
Fiasco) and SCA.
|
| 1734 |
|
1750 |
|
| 1735 |
<p>ESS grew out of the desire for bug fixes and extensions to S-mode 4.8
|
1751 |
<p>ESS grew out of the desire for bug fixes and extensions to S-mode 4.8
|
| 1736 |
(which was a GNU Emacs interface to S/S-PLUS version 3 only). The
|
1752 |
(which was a GNU Emacs interface to S/<small>S-PLUS</small> version 3 only). The
|
| 1737 |
current set of developers desired support for XEmacs, R, S4, and MS
|
1753 |
current set of developers desired support for XEmacs, R, S4, and MS
|
| 1738 |
Windows. In addition, with new modes being developed for R, Stata, and
|
1754 |
Windows. In addition, with new modes being developed for R, Stata, and
|
| 1739 |
SAS, it was felt a unifying interface and framework for the user
|
1755 |
SAS, it was felt a unifying interface and framework for the user
|
| 1740 |
interface, would benefit both the user and the developer, by helping
|
1756 |
interface, would benefit both the user and the developer, by helping
|
| 1741 |
both groups conform to standard Emacs usage. The end result is an
|
1757 |
both groups conform to standard Emacs usage. The end result is an
|
| Line 1754... |
Line 1770... |
| 1754 |
(recording and saving transcript files, manipulating and editing saved
|
1770 |
(recording and saving transcript files, manipulating and editing saved
|
| 1755 |
transcripts, and re-evaluating commands from transcript files).
|
1771 |
transcripts, and re-evaluating commands from transcript files).
|
| 1756 |
|
1772 |
|
| 1757 |
<p>The latest versions of ESS are available from
|
1773 |
<p>The latest versions of ESS are available from
|
| 1758 |
<a href="http://ess.stat.wisc.edu/pub/ESS/">http://ess.stat.wisc.edu/pub/ESS/</a> or
|
1774 |
<a href="http://ess.stat.wisc.edu/pub/ESS/">http://ess.stat.wisc.edu/pub/ESS/</a> or
|
| 1759 |
<a href="ftp://ess.stat.wisc.edu/pub/ESS/">ftp://ess.stat.wisc.edu/pub/ESS/</a>, or via CRAN. The HTML version
|
1775 |
<a href="ftp://ess.stat.wisc.edu/pub/ESS/">ftp://ess.stat.wisc.edu/pub/ESS/</a>, or via CRAN. The <small>HTML</small>
|
| - |
|
1776 |
version of the documentation can be found at
|
| 1760 |
of the documentation can be found at <a href="http://stat.ethz.ch/ESS/">http://stat.ethz.ch/ESS/</a>.
|
1777 |
<a href="http://stat.ethz.ch/ESS/">http://stat.ethz.ch/ESS/</a>.
|
| 1761 |
|
1778 |
|
| 1762 |
<p>ESS comes with detailed installation instructions.
|
1779 |
<p>ESS comes with detailed installation instructions.
|
| 1763 |
|
1780 |
|
| 1764 |
<p>For help with ESS, send email to <a href="mailto:ESS-help@stat.ethz.ch">ESS-help@stat.ethz.ch</a>.
|
1781 |
<p>For help with ESS, send email to <a href="mailto:ESS-help@stat.ethz.ch">ESS-help@stat.ethz.ch</a>.
|
| 1765 |
|
1782 |
|
| Line 1768... |
Line 1785... |
| 1768 |
within Emacs by typing <kbd>M-x ess-submit-bug-report</kbd> or using the
|
1785 |
within Emacs by typing <kbd>M-x ess-submit-bug-report</kbd> or using the
|
| 1769 |
[ESS] or [iESS] pulldown menus.
|
1786 |
[ESS] or [iESS] pulldown menus.
|
| 1770 |
|
1787 |
|
| 1771 |
<p><hr>
|
1788 |
<p><hr>
|
| 1772 |
Node:<a name="Should%20I%20run%20R%20from%20within%20Emacs%3f">Should I run R from within Emacs?</a>,
|
1789 |
Node:<a name="Should%20I%20run%20R%20from%20within%20Emacs%3f">Should I run R from within Emacs?</a>,
|
| - |
|
1790 |
Next:<a rel=next href="#Debugging%20R%20from%20within%20Emacs">Debugging R from within Emacs</a>,
|
| 1773 |
Previous:<a rel=previous href="#Is%20there%20Emacs%20support%20for%20R%3f">Is there Emacs support for R?</a>,
|
1791 |
Previous:<a rel=previous href="#Is%20there%20Emacs%20support%20for%20R%3f">Is there Emacs support for R?</a>,
|
| 1774 |
Up:<a rel=up href="#R%20and%20Emacs">R and Emacs</a>
|
1792 |
Up:<a rel=up href="#R%20and%20Emacs">R and Emacs</a>
|
| 1775 |
<br>
|
1793 |
<br>
|
| 1776 |
|
1794 |
|
| 1777 |
<h2>6.2 Should I run R from within Emacs?</h2>
|
1795 |
<h2>6.2 Should I run R from within Emacs?</h2>
|
| Line 1795... |
Line 1813... |
| 1795 |
<p>To specify command line arguments for the inferior R process, use
|
1813 |
<p>To specify command line arguments for the inferior R process, use
|
| 1796 |
<kbd>C-u M-x R</kbd> for starting R. This prompts you for the arguments; in
|
1814 |
<kbd>C-u M-x R</kbd> for starting R. This prompts you for the arguments; in
|
| 1797 |
particular, you can increase the memory size this way (see <a href="#Why%20does%20R%20run%20out%20of%20memory%3f">Why does R run out of memory?</a>).
|
1815 |
particular, you can increase the memory size this way (see <a href="#Why%20does%20R%20run%20out%20of%20memory%3f">Why does R run out of memory?</a>).
|
| 1798 |
|
1816 |
|
| 1799 |
<p><hr>
|
1817 |
<p><hr>
|
| - |
|
1818 |
Node:<a name="Debugging%20R%20from%20within%20Emacs">Debugging R from within Emacs</a>,
|
| - |
|
1819 |
Previous:<a rel=previous href="#Should%20I%20run%20R%20from%20within%20Emacs%3f">Should I run R from within Emacs?</a>,
|
| - |
|
1820 |
Up:<a rel=up href="#R%20and%20Emacs">R and Emacs</a>
|
| - |
|
1821 |
<br>
|
| - |
|
1822 |
|
| - |
|
1823 |
<h2>6.3 Debugging R from within Emacs</h2>
|
| - |
|
1824 |
|
| - |
|
1825 |
<p>To debug R "from within Emacs", there are several possibilities. To
|
| - |
|
1826 |
use GUD mode, type <kbd>M-x gdb</kbd> and give the path to the R
|
| - |
|
1827 |
<em>binary</em>, typically <code>R.X11</code>, as argument. At the gdb prompt,
|
| - |
|
1828 |
set <code>R_HOME</code> and other environment variables as needed (using e.g.
|
| - |
|
1829 |
<kbd>set env R_HOME /path/to/R/</kbd>, but see also below), and start the
|
| - |
|
1830 |
binary with the desired arguments (e.g., <kbd>r --vsize 12M</kbd>).
|
| - |
|
1831 |
|
| - |
|
1832 |
<p>If you have ESS, you can do <kbd>C-u M-x R<RET>-d gdb</kbd> to start an
|
| - |
|
1833 |
inferior R process with arguments <code>-d gdb</code>.
|
| - |
|
1834 |
|
| - |
|
1835 |
<p>A third option is to start an inferior R process via ESS (<kbd>M-x R</kbd>)
|
| - |
|
1836 |
and then start GUD (<kbd>M-x gdb</kbd>) giving <code>$R_HOME/bin/R.X11</code> as
|
| - |
|
1837 |
the program to debug. Use the program <code>ps</code> to find the process
|
| - |
|
1838 |
number of the currently running R process then use the <code>attach</code>
|
| - |
|
1839 |
command in gdb to attach it to that process. One advantage of this
|
| - |
|
1840 |
method is that you have separate <code>*R*</code> and <code>*gud-gdb*</code>
|
| - |
|
1841 |
windows. Within the <code>*R*</code> window you have all the ESS facilities,
|
| - |
|
1842 |
such as object-name completion, that we know and love.
|
| - |
|
1843 |
|
| - |
|
1844 |
<p>When using GUD mode for debugging from within Emacs, you may find it
|
| - |
|
1845 |
most convenient to use the directory with your code in it as the current
|
| - |
|
1846 |
working directory and then make a symbolic link from that directory to
|
| - |
|
1847 |
the R executable. That way <code>.gdbinit</code> can stay in the directory
|
| - |
|
1848 |
with the code and be used to set up the environment and the search paths
|
| - |
|
1849 |
for the source, e.g. as follows:
|
| - |
|
1850 |
|
| - |
|
1851 |
<pre>set env R_HOME /opt/R
|
| - |
|
1852 |
set env R_PAPERSIZE letter
|
| - |
|
1853 |
set env R_PRINTCMD lpr
|
| - |
|
1854 |
dir /opt/R/src/appl
|
| - |
|
1855 |
dir /opt/R/src/main
|
| - |
|
1856 |
dir /opt/R/src/nmath
|
| - |
|
1857 |
dir /opt/R/src/unix
|
| - |
|
1858 |
</pre>
|
| - |
|
1859 |
|
| - |
|
1860 |
<p><hr>
|
| 1800 |
Node:<a name="R%20Miscellania">R Miscellania</a>,
|
1861 |
Node:<a name="R%20Miscellania">R Miscellania</a>,
|
| 1801 |
Next:<a rel=next href="#R%20Programming">R Programming</a>,
|
1862 |
Next:<a rel=next href="#R%20Programming">R Programming</a>,
|
| 1802 |
Previous:<a rel=previous href="#R%20and%20Emacs">R and Emacs</a>,
|
1863 |
Previous:<a rel=previous href="#R%20and%20Emacs">R and Emacs</a>,
|
| 1803 |
Up:<a rel=up href="#Top">Top</a>
|
1864 |
Up:<a rel=up href="#Top">Top</a>
|
| 1804 |
<br>
|
1865 |
<br>
|
| Line 2194... |
Line 2255... |
| 2194 |
<p>According to Doug Bates, the secret of symbolic debugging of dynamically
|
2255 |
<p>According to Doug Bates, the secret of symbolic debugging of dynamically
|
| 2195 |
loaded code is to
|
2256 |
loaded code is to
|
| 2196 |
|
2257 |
|
| 2197 |
<ul>
|
2258 |
<ul>
|
| 2198 |
<li>Call the debugger on the R executable. In the shell, you can e.g. use
|
2259 |
<li>Call the debugger on the R executable. In the shell, you can e.g. use
|
| 2199 |
<kbd>R -d gdb</kbd>; see below for debugging from within Emacs.
|
2260 |
<kbd>R -d gdb</kbd>; see <a href="#Debugging%20R%20from%20within%20Emacs">Debugging R from within Emacs</a> for debugging
|
| - |
|
2261 |
from within Emacs.
|
| 2200 |
<li>Start the R program.
|
2262 |
<li>Start the R program.
|
| 2201 |
<li>At the R prompt, use <code>dyn.load()</code> to load your library.
|
2263 |
<li>At the R prompt, use <code>dyn.load()</code> to load your library.
|
| 2202 |
<li>Send an interrupt signal. Inside of GUD mode in Emacs, you send
|
2264 |
<li>Send an interrupt signal. Inside of GUD mode in Emacs, you send
|
| 2203 |
<kbd>C-c C-c</kbd>. This will put you back to the debugger prompt.
|
2265 |
<kbd>C-c C-c</kbd>. This will put you back to the debugger prompt.
|
| 2204 |
<li>Set the breakpoints in your code.
|
2266 |
<li>Set the breakpoints in your code.
|
| 2205 |
<li>Continue execution of R by typing <kbd>signal 0<RET></kbd>.
|
2267 |
<li>Continue execution of R by typing <kbd>signal 0<RET></kbd>.
|
| 2206 |
</ul>
|
2268 |
</ul>
|
| 2207 |
|
2269 |
|
| 2208 |
<p>When using GUD mode for debugging from within Emacs, you may find it
|
- |
|
| 2209 |
most convenient to use the directory with your code in it as the current
|
- |
|
| 2210 |
working directory and then make a symbolic link from that directory to
|
- |
|
| 2211 |
the R executable. That way <code>.gdbinit</code> can stay in the directory
|
- |
|
| 2212 |
with the code and be used to set up the environment and the search paths
|
- |
|
| 2213 |
for the source, e.g. as follows:
|
- |
|
| 2214 |
|
- |
|
| 2215 |
<pre>set env R_HOME /opt/R
|
- |
|
| 2216 |
set env R_PAPERSIZE letter
|
- |
|
| 2217 |
set env R_PRINTCMD lpr
|
- |
|
| 2218 |
dir /opt/R/src/appl
|
- |
|
| 2219 |
dir /opt/R/src/main
|
- |
|
| 2220 |
dir /opt/R/src/nmath
|
- |
|
| 2221 |
dir /opt/R/src/unix
|
- |
|
| 2222 |
</pre>
|
- |
|
| 2223 |
|
- |
|
| 2224 |
<p><hr>
|
2270 |
<p><hr>
|
| 2225 |
Node:<a name="How%20can%20I%20inspect%20R%20objects%20when%20debugging%3f">How can I inspect R objects when debugging?</a>,
|
2271 |
Node:<a name="How%20can%20I%20inspect%20R%20objects%20when%20debugging%3f">How can I inspect R objects when debugging?</a>,
|
| 2226 |
Previous:<a rel=previous href="#How%20can%20I%20debug%20dynamically%20loaded%20code%3f">How can I debug dynamically loaded code?</a>,
|
2272 |
Previous:<a rel=previous href="#How%20can%20I%20debug%20dynamically%20loaded%20code%3f">How can I debug dynamically loaded code?</a>,
|
| 2227 |
Up:<a rel=up href="#R%20Programming">R Programming</a>
|
2273 |
Up:<a rel=up href="#R%20Programming">R Programming</a>
|
| 2228 |
<br>
|
2274 |
<br>
|