| Line 1... |
Line 1... |
| 1 |
R FAQ
|
1 |
R FAQ
|
| 2 |
Frequently Asked Questions on R
|
2 |
Frequently Asked Questions on R
|
| 3 |
Version 0.90-2, 1999/11/25
|
3 |
Version 0.90-4, 1999/11/13
|
| 4 |
Kurt Hornik
|
4 |
Kurt Hornik
|
| 5 |
|
5 |
|
| 6 |
|
6 |
|
| 7 |
Table of Contents
|
7 |
Table of Contents
|
| 8 |
*****************
|
8 |
*****************
|
| Line 50... |
Line 50... |
| 50 |
5.6 How can I contribute to R?
|
50 |
5.6 How can I contribute to R?
|
| 51 |
|
51 |
|
| 52 |
6 R and Emacs
|
52 |
6 R and Emacs
|
| 53 |
6.1 Is there Emacs support for R?
|
53 |
6.1 Is there Emacs support for R?
|
| 54 |
6.2 Should I run R from within Emacs?
|
54 |
6.2 Should I run R from within Emacs?
|
| - |
|
55 |
6.3 Debugging R from within Emacs
|
| 55 |
|
56 |
|
| 56 |
7 R Miscellania
|
57 |
7 R Miscellania
|
| 57 |
7.1 Why does R run out of memory?
|
58 |
7.1 Why does R run out of memory?
|
| 58 |
7.2 Why does sourcing a correct file fail?
|
59 |
7.2 Why does sourcing a correct file fail?
|
| 59 |
7.3 How can I set components of a list to NULL?
|
60 |
7.3 How can I set components of a list to NULL?
|
| Line 196... |
Line 197... |
| 196 |
If you know about other platforms, please drop us a note.
|
197 |
If you know about other platforms, please drop us a note.
|
| 197 |
|
198 |
|
| 198 |
2.3 What is the current version of R?
|
199 |
2.3 What is the current version of R?
|
| 199 |
=====================================
|
200 |
=====================================
|
| 200 |
|
201 |
|
| 201 |
The current stable Unix/Windows version is 0.90.0, the unstable one is
|
202 |
The current stable Unix/Windows version is 0.90.1, the unstable one is
|
| 202 |
0.99.0. Typically, new features are introduced in the development
|
203 |
0.99.0. Typically, new features are introduced in the development
|
| 203 |
versions; updates of stable versions are for bug fixes mostly. The version
|
204 |
versions; updates of stable versions are for bug fixes mostly. The version
|
| 204 |
for the Mac is pre-alpha.
|
205 |
for the Mac is pre-alpha.
|
| 205 |
|
206 |
|
| 206 |
2.4 How can R be obtained?
|
207 |
2.4 How can R be obtained?
|
| Line 299... |
Line 300... |
| 299 |
|
300 |
|
| 300 |
The `bin/linux' directory contains Debian 2.1 packages for the i386
|
301 |
The `bin/linux' directory contains Debian 2.1 packages for the i386
|
| 301 |
platform (now part of the Debian distribution and maintained by Doug Bates)
|
302 |
platform (now part of the Debian distribution and maintained by Doug Bates)
|
| 302 |
as well as Red Hat 5.1 packages for the alpha and sparc platforms
|
303 |
as well as Red Hat 5.1 packages for the alpha and sparc platforms
|
| 303 |
(maintained by Nassib Nasser and Vin Everett, respectively), Red Hat 6.0
|
304 |
(maintained by Nassib Nasser and Vin Everett, respectively), Red Hat 6.0
|
| 304 |
packages for the i386 and alpha platforms (maintained by Martyn Plummer and
|
305 |
packages for the i386, alpha and sparc platforms (maintained by Martyn
|
| 305 |
Naoki Takebayashi, respectively), S.u.S.E. 5.3/6.0/6.2 i386 packages by
|
306 |
Plummer, Naoki Takebayashi, and Vin Everett, respectively), S.u.S.E.
|
| 306 |
Albrecht Gebhardt, and RPMs for the ppc platform by Alex Buerkle.
|
307 |
5.3/6.0/6.2 i386 packages by Albrecht Gebhardt, and RPMs for the ppc
|
| - |
|
308 |
platform by Alex Buerkle.
|
| 307 |
|
309 |
|
| 308 |
The `bin/osf' directory contains RPMs for alpha systems running Digital
|
310 |
The `bin/osf' directory contains RPMs for alpha systems running Digital
|
| 309 |
Unix 4.0 by Albrecht Gebhardt.
|
311 |
Unix 4.0 by Albrecht Gebhardt.
|
| 310 |
|
312 |
|
| 311 |
No other binary distributions have thus far been made publically
|
313 |
No other binary distributions have thus far been made publically
|
| Line 390... |
Line 392... |
| 390 |
|
392 |
|
| 391 |
`r-help'
|
393 |
`r-help'
|
| 392 |
The `main' R mailing list, for announcements about the development of R
|
394 |
The `main' R mailing list, for announcements about the development of R
|
| 393 |
and the availability of new code, questions and answers about problems
|
395 |
and the availability of new code, questions and answers about problems
|
| 394 |
and solutions using R, enhancements and patches to the source code and
|
396 |
and solutions using R, enhancements and patches to the source code and
|
| 395 |
documentation of R, comparison and compatibility with S and S-PLUS, and
|
397 |
documentation of R, comparison and compatibility with S and S-PLUS,
|
| 396 |
for the posting of nice examples and benchmarks.
|
398 |
and for the posting of nice examples and benchmarks.
|
| 397 |
|
399 |
|
| 398 |
Note that the r-announce list is gatewayed into r-help, so you don't need
|
400 |
Note that the r-announce list is gatewayed into r-help, so you don't need
|
| 399 |
to subscribe to both of them.
|
401 |
to subscribe to both of them.
|
| 400 |
|
402 |
|
| 401 |
Send email to <r-help@lists.r-project.org> to reach everyone on the
|
403 |
Send email to <r-help@lists.r-project.org> to reach everyone on the
|
| Line 1185... |
Line 1187... |
| 1185 |
Kalman filter, VARMA and cointegration models, and numerical
|
1187 |
Kalman filter, VARMA and cointegration models, and numerical
|
| 1186 |
differentiation. It also contains Troll models as another class (the Troll
|
1188 |
differentiation. It also contains Troll models as another class (the Troll
|
| 1187 |
interface is not yet functional in R). Paul's package *dse* can be
|
1189 |
interface is not yet functional in R). Paul's package *dse* can be
|
| 1188 |
obtained via `http://www.bank-banque-canada.ca/pgilbert/dsedesc.htm'.
|
1190 |
obtained via `http://www.bank-banque-canada.ca/pgilbert/dsedesc.htm'.
|
| 1189 |
|
1191 |
|
| - |
|
1192 |
Timothy H. Keitt <keitt@nceas.ucsb.edu> has written *RPgSQL*, a package
|
| - |
|
1193 |
which allows users to read and write data frames to and from a PostgreSQL
|
| - |
|
1194 |
database (and also has a low-level interface for sending SQL queries to the
|
| - |
|
1195 |
PostgreSQL backend, and retrieving results), and can be obtained from
|
| - |
|
1196 |
`http://www.nceas.ucsb.edu/~keitt/R/'. There is also the *RODBC* package
|
| - |
|
1197 |
by Michael Lapsley <mlapsley@ndirect.co.uk> which provides an R ODBC
|
| - |
|
1198 |
interface; see `http://www.ndirect.co.uk/~mlapsley/' for more information.
|
| - |
|
1199 |
|
| 1190 |
More code has been posted to the r-help mailing list, and can be
|
1200 |
More code has been posted to the r-help mailing list, and can be
|
| 1191 |
obtained from the mailing list archive.
|
1201 |
obtained from the mailing list archive.
|
| 1192 |
|
1202 |
|
| 1193 |
5.2 How can add-on packages be installed?
|
1203 |
5.2 How can add-on packages be installed?
|
| 1194 |
=========================================
|
1204 |
=========================================
|
| Line 1379... |
Line 1389... |
| 1379 |
One place where functionality is still missing is the modeling software
|
1389 |
One place where functionality is still missing is the modeling software
|
| 1380 |
as described in "Statistical Models in S" (see *Note What is S?::);
|
1390 |
as described in "Statistical Models in S" (see *Note What is S?::);
|
| 1381 |
Generalized Additive Models (*gam*) and some of the nonlinear modeling code
|
1391 |
Generalized Additive Models (*gam*) and some of the nonlinear modeling code
|
| 1382 |
are not there yet.
|
1392 |
are not there yet.
|
| 1383 |
|
1393 |
|
| - |
|
1394 |
The R Developer Page (http://developer.r-project.org) acts as an
|
| - |
|
1395 |
intermediate repository for more or less finalized ideas and plans for the
|
| 1384 |
See also the `PROJECTS' file in the top level R source directory.
|
1396 |
R statistical system. It contains (pointers to) TODO lists, RFCs, various
|
| - |
|
1397 |
other writeups, ideas lists, and CVS miscellania.
|
| 1385 |
|
1398 |
|
| 1386 |
Many (more) of the packages available at the Statlib S Repository might
|
1399 |
Many (more) of the packages available at the Statlib S Repository might
|
| 1387 |
be worth porting to R.
|
1400 |
be worth porting to R.
|
| 1388 |
|
1401 |
|
| 1389 |
If you are interested in working on any of these projects, please notify
|
1402 |
If you are interested in working on any of these projects, please notify
|
| Line 1458... |
Line 1471... |
| 1458 |
To specify command line arguments for the inferior R process, use `C-u
|
1471 |
To specify command line arguments for the inferior R process, use `C-u
|
| 1459 |
M-x R' for starting R. This prompts you for the arguments; in particular,
|
1472 |
M-x R' for starting R. This prompts you for the arguments; in particular,
|
| 1460 |
you can increase the memory size this way (*note Why does R run out of
|
1473 |
you can increase the memory size this way (*note Why does R run out of
|
| 1461 |
memory?::).
|
1474 |
memory?::).
|
| 1462 |
|
1475 |
|
| - |
|
1476 |
6.3 Debugging R from within Emacs
|
| - |
|
1477 |
=================================
|
| - |
|
1478 |
|
| - |
|
1479 |
To debug R "from within Emacs", there are several possibilities. To use
|
| - |
|
1480 |
GUD mode, type `M-x gdb' and give the path to the R _binary_, typically
|
| - |
|
1481 |
`R.X11', as argument. At the gdb prompt, set `R_HOME' and other
|
| - |
|
1482 |
environment variables as needed (using e.g. `set env R_HOME /path/to/R/',
|
| - |
|
1483 |
but see also below), and start the binary with the desired arguments (e.g.,
|
| - |
|
1484 |
`r --vsize 12M').
|
| - |
|
1485 |
|
| - |
|
1486 |
If you have ESS, you can do `C-u M-x R<RET>-d gdb' to start an inferior
|
| - |
|
1487 |
R process with arguments `-d gdb'.
|
| - |
|
1488 |
|
| - |
|
1489 |
A third option is to start an inferior R process via ESS (`M-x R') and
|
| - |
|
1490 |
then start GUD (`M-x gdb') giving `$R_HOME/bin/R.X11' as the program to
|
| - |
|
1491 |
debug. Use the program `ps' to find the process number of the currently
|
| - |
|
1492 |
running R process then use the `attach' command in gdb to attach it to that
|
| - |
|
1493 |
process. One advantage of this method is that you have separate `*R*' and
|
| - |
|
1494 |
`*gud-gdb*' windows. Within the `*R*' window you have all the ESS
|
| - |
|
1495 |
facilities, such as object-name completion, that we know and love.
|
| - |
|
1496 |
|
| - |
|
1497 |
When using GUD mode for debugging from within Emacs, you may find it
|
| - |
|
1498 |
most convenient to use the directory with your code in it as the current
|
| - |
|
1499 |
working directory and then make a symbolic link from that directory to the
|
| - |
|
1500 |
R executable. That way `.gdbinit' can stay in the directory with the code
|
| - |
|
1501 |
and be used to set up the environment and the search paths for the source,
|
| - |
|
1502 |
e.g. as follows:
|
| - |
|
1503 |
|
| - |
|
1504 |
set env R_HOME /opt/R
|
| - |
|
1505 |
set env R_PAPERSIZE letter
|
| - |
|
1506 |
set env R_PRINTCMD lpr
|
| - |
|
1507 |
dir /opt/R/src/appl
|
| - |
|
1508 |
dir /opt/R/src/main
|
| - |
|
1509 |
dir /opt/R/src/nmath
|
| - |
|
1510 |
dir /opt/R/src/unix
|
| - |
|
1511 |
|
| 1463 |
7 R Miscellania
|
1512 |
7 R Miscellania
|
| 1464 |
***************
|
1513 |
***************
|
| 1465 |
|
1514 |
|
| 1466 |
7.1 Why does R run out of memory?
|
1515 |
7.1 Why does R run out of memory?
|
| 1467 |
=================================
|
1516 |
=================================
|
| Line 1721... |
Line 1770... |
| 1721 |
|
1770 |
|
| 1722 |
According to Doug Bates, the secret of symbolic debugging of dynamically
|
1771 |
According to Doug Bates, the secret of symbolic debugging of dynamically
|
| 1723 |
loaded code is to
|
1772 |
loaded code is to
|
| 1724 |
|
1773 |
|
| 1725 |
* Call the debugger on the R executable. In the shell, you can e.g. use
|
1774 |
* Call the debugger on the R executable. In the shell, you can e.g. use
|
| 1726 |
`R -d gdb'; see below for debugging from within Emacs.
|
1775 |
`R -d gdb'; see *Note Debugging R from within Emacs:: for debugging
|
| - |
|
1776 |
from within Emacs.
|
| 1727 |
|
1777 |
|
| 1728 |
* Start the R program.
|
1778 |
* Start the R program.
|
| 1729 |
|
1779 |
|
| 1730 |
* At the R prompt, use `dyn.load()' to load your library.
|
1780 |
* At the R prompt, use `dyn.load()' to load your library.
|
| 1731 |
|
1781 |
|
| Line 1734... |
Line 1784... |
| 1734 |
|
1784 |
|
| 1735 |
* Set the breakpoints in your code.
|
1785 |
* Set the breakpoints in your code.
|
| 1736 |
|
1786 |
|
| 1737 |
* Continue execution of R by typing `signal 0<RET>'.
|
1787 |
* Continue execution of R by typing `signal 0<RET>'.
|
| 1738 |
|
1788 |
|
| 1739 |
When using GUD mode for debugging from within Emacs, you may find it
|
- |
|
| 1740 |
most convenient to use the directory with your code in it as the current
|
- |
|
| 1741 |
working directory and then make a symbolic link from that directory to the
|
- |
|
| 1742 |
R executable. That way `.gdbinit' can stay in the directory with the code
|
- |
|
| 1743 |
and be used to set up the environment and the search paths for the source,
|
- |
|
| 1744 |
e.g. as follows:
|
- |
|
| 1745 |
|
- |
|
| 1746 |
set env R_HOME /opt/R
|
- |
|
| 1747 |
set env R_PAPERSIZE letter
|
- |
|
| 1748 |
set env R_PRINTCMD lpr
|
- |
|
| 1749 |
dir /opt/R/src/appl
|
- |
|
| 1750 |
dir /opt/R/src/main
|
- |
|
| 1751 |
dir /opt/R/src/nmath
|
- |
|
| 1752 |
dir /opt/R/src/unix
|
- |
|
| 1753 |
|
- |
|
| 1754 |
8.3 How can I inspect R objects when debugging?
|
1789 |
8.3 How can I inspect R objects when debugging?
|
| 1755 |
===============================================
|
1790 |
===============================================
|
| 1756 |
|
1791 |
|
| 1757 |
In the C implementation underlying R, all objects are so-called SEXPs
|
1792 |
In the C implementation underlying R, all objects are so-called SEXPs
|
| 1758 |
(from Lisp's "S-expressions" which comes from "symbolic expression"), which
|
1793 |
(from Lisp's "S-expressions" which comes from "symbolic expression"), which
|