The R Project SVN R

Rev

Rev 28302 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 28302 Rev 28362
1
START-INFO-DIR-ENTRY
1
START-INFO-DIR-ENTRY
2
* R FAQ: (R-FAQ).               The R statistical system FAQ.
2
* R FAQ: (R-FAQ).               The R statistical system FAQ.
3
END-INFO-DIR-ENTRY
3
END-INFO-DIR-ENTRY
4
 
4
 
5
   R FAQ
5
   R FAQ
6
Frequently Asked Questions on R
6
Frequently Asked Questions on R
7
Version 1.8-40, 2004-02-13
7
Version 1.8-42, 2004-02-19
8
ISBN 3-900051-01-1
8
ISBN 3-900051-01-1
9
Kurt Hornik
9
Kurt Hornik
10
 
10
 
11
 
11
 
12
Table of Contents
12
Table of Contents
13
*****************
13
*****************
14
 
14
 
15
 
15
 
16
R FAQ
16
R FAQ
17
 
17
 
18
1 Introduction
18
1 Introduction
19
  1.1 Legalese
19
  1.1 Legalese
20
  1.2 Obtaining this document
20
  1.2 Obtaining this document
21
  1.3 Citing this document
21
  1.3 Citing this document
22
  1.4 Notation
22
  1.4 Notation
23
  1.5 Feedback
23
  1.5 Feedback
24
 
24
 
25
2 R Basics
25
2 R Basics
26
  2.1 What is R?
26
  2.1 What is R?
27
  2.2 What machines does R run on?
27
  2.2 What machines does R run on?
28
  2.3 What is the current version of R?
28
  2.3 What is the current version of R?
29
  2.4 How can R be obtained?
29
  2.4 How can R be obtained?
30
  2.5 How can R be installed?
30
  2.5 How can R be installed?
31
    2.5.1 How can R be installed (Unix)
31
    2.5.1 How can R be installed (Unix)
32
    2.5.2 How can R be installed (Windows)
32
    2.5.2 How can R be installed (Windows)
33
    2.5.3 How can R be installed (Macintosh)
33
    2.5.3 How can R be installed (Macintosh)
34
  2.6 Are there Unix binaries for R?
34
  2.6 Are there Unix binaries for R?
35
  2.7 What documentation exists for R?
35
  2.7 What documentation exists for R?
36
  2.8 Citing R
36
  2.8 Citing R
37
  2.9 What mailing lists exist for R?
37
  2.9 What mailing lists exist for R?
38
  2.10 What is CRAN?
38
  2.10 What is CRAN?
39
  2.11 Can I use R for commercial purposes?
39
  2.11 Can I use R for commercial purposes?
40
  2.12 Why is R named R?
40
  2.12 Why is R named R?
41
 
41
 
42
3 R and S
42
3 R and S
43
  3.1 What is S?
43
  3.1 What is S?
44
  3.2 What is S-PLUS?
44
  3.2 What is S-PLUS?
45
  3.3 What are the differences between R and S?
45
  3.3 What are the differences between R and S?
46
    3.3.1 Lexical scoping
46
    3.3.1 Lexical scoping
47
    3.3.2 Models
47
    3.3.2 Models
48
    3.3.3 Others
48
    3.3.3 Others
49
  3.4 Is there anything R can do that S-PLUS cannot?
49
  3.4 Is there anything R can do that S-PLUS cannot?
50
  3.5 What is R-plus?
50
  3.5 What is R-plus?
51
 
51
 
52
4 R Web Interfaces
52
4 R Web Interfaces
53
 
53
 
54
5 R Add-On Packages
54
5 R Add-On Packages
55
  5.1 Which add-on packages exist for R?
55
  5.1 Which add-on packages exist for R?
56
    5.1.1 Add-on packages in R
56
    5.1.1 Add-on packages in R
57
    5.1.2 Add-on packages from CRAN
57
    5.1.2 Add-on packages from CRAN
58
    5.1.3 Add-on packages from Omegahat
58
    5.1.3 Add-on packages from Omegahat
59
    5.1.4 Add-on packages from BioConductor
59
    5.1.4 Add-on packages from BioConductor
60
    5.1.5 Other add-on packages
60
    5.1.5 Other add-on packages
61
  5.2 How can add-on packages be installed?
61
  5.2 How can add-on packages be installed?
62
  5.3 How can add-on packages be used?
62
  5.3 How can add-on packages be used?
63
  5.4 How can add-on packages be removed?
63
  5.4 How can add-on packages be removed?
64
  5.5 How can I create an R package?
64
  5.5 How can I create an R package?
65
  5.6 How can I contribute to R?
65
  5.6 How can I contribute to R?
66
 
66
 
67
6 R and Emacs
67
6 R and Emacs
68
  6.1 Is there Emacs support for R?
68
  6.1 Is there Emacs support for R?
69
  6.2 Should I run R from within Emacs?
69
  6.2 Should I run R from within Emacs?
70
  6.3 Debugging R from within Emacs
70
  6.3 Debugging R from within Emacs
71
 
71
 
72
7 R Miscellanea
72
7 R Miscellanea
73
  7.1 Why does R run out of memory?
73
  7.1 Why does R run out of memory?
74
  7.2 Why does sourcing a correct file fail?
74
  7.2 Why does sourcing a correct file fail?
75
  7.3 How can I set components of a list to NULL?
75
  7.3 How can I set components of a list to NULL?
76
  7.4 How can I save my workspace?
76
  7.4 How can I save my workspace?
77
  7.5 How can I clean up my workspace?
77
  7.5 How can I clean up my workspace?
78
  7.6 How can I get eval() and D() to work?
78
  7.6 How can I get eval() and D() to work?
79
  7.7 Why do my matrices lose dimensions?
79
  7.7 Why do my matrices lose dimensions?
80
  7.8 How does autoloading work?
80
  7.8 How does autoloading work?
81
  7.9 How should I set options?
81
  7.9 How should I set options?
82
  7.10 How do file names work in Windows?
82
  7.10 How do file names work in Windows?
83
  7.11 Why does plotting give a color allocation error?
83
  7.11 Why does plotting give a color allocation error?
84
  7.12 How do I convert factors to numeric?
84
  7.12 How do I convert factors to numeric?
85
  7.13 Are Trellis displays implemented in R?
85
  7.13 Are Trellis displays implemented in R?
86
  7.14 What are the enclosing and parent environments?
86
  7.14 What are the enclosing and parent environments?
87
  7.15 How can I substitute into a plot label?
87
  7.15 How can I substitute into a plot label?
88
  7.16 What are valid names?
88
  7.16 What are valid names?
89
  7.17 Are GAMs implemented in R?
89
  7.17 Are GAMs implemented in R?
90
  7.18 Why is the output not printed when I source() a file?
90
  7.18 Why is the output not printed when I source() a file?
91
  7.19 Why does outer() behave strangely with my function?
91
  7.19 Why does outer() behave strangely with my function?
92
  7.20 Why does the output from anova() depend on the order of factors in the model?
92
  7.20 Why does the output from anova() depend on the order of factors in the model?
93
  7.21 How do I produce PNG graphics in batch mode?
93
  7.21 How do I produce PNG graphics in batch mode?
94
  7.22 How can I get command line editing to work?
94
  7.22 How can I get command line editing to work?
95
  7.23 How can I turn a string into a variable?
95
  7.23 How can I turn a string into a variable?
96
  7.24 Why do lattice/trellis graphics not work?
96
  7.24 Why do lattice/trellis graphics not work?
97
  7.25 How can I sort the rows of a data frame?
97
  7.25 How can I sort the rows of a data frame?
98
 
98
 
99
8 R Programming
99
8 R Programming
100
  8.1 How should I write summary methods?
100
  8.1 How should I write summary methods?
101
  8.2 How can I debug dynamically loaded code?
101
  8.2 How can I debug dynamically loaded code?
102
  8.3 How can I inspect R objects when debugging?
102
  8.3 How can I inspect R objects when debugging?
103
  8.4 How can I change compilation flags?
103
  8.4 How can I change compilation flags?
104
 
104
 
105
9 R Bugs
105
9 R Bugs
106
  9.1 What is a bug?
106
  9.1 What is a bug?
107
  9.2 How to report a bug
107
  9.2 How to report a bug
108
 
108
 
109
10 Acknowledgments
109
10 Acknowledgments
110
 
110
 
111
 
111
 
112
R FAQ
112
R FAQ
113
*****
113
*****
114
 
114
 
115
1 Introduction
115
1 Introduction
116
**************
116
**************
117
 
117
 
118
This document contains answers to some of the most frequently asked
118
This document contains answers to some of the most frequently asked
119
questions about R.
119
questions about R.
120
 
120
 
121
1.1 Legalese
121
1.1 Legalese
122
============
122
============
123
 
123
 
124
This document is copyright (C) 1998-2004 by Kurt Hornik.
124
This document is copyright (C) 1998-2004 by Kurt Hornik.
125
 
125
 
126
   This document is free software; you can redistribute it and/or modify it
126
   This document is free software; you can redistribute it and/or modify it
127
under the terms of the GNU General Public License as published by the Free
127
under the terms of the GNU General Public License as published by the Free
128
Software Foundation; either version 2, or (at your option) any later
128
Software Foundation; either version 2, or (at your option) any later
129
version.
129
version.
130
 
130
 
131
   This document is distributed in the hope that it will be useful, but
131
   This document is distributed in the hope that it will be useful, but
132
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
132
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
133
or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
133
or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
134
for more details.
134
for more details.
135
 
135
 
136
   A copy of the GNU General Public License is available via WWW at
136
   A copy of the GNU General Public License is available via WWW at
137
 
137
 
138
     `http://www.gnu.org/copyleft/gpl.html'.
138
     `http://www.gnu.org/copyleft/gpl.html'.
139
 
139
 
140
You can also obtain it by writing to the Free Software Foundation, Inc., 59
140
You can also obtain it by writing to the Free Software Foundation, Inc., 59
141
Temple Place -- Suite 330, Boston, MA 02111-1307, USA.
141
Temple Place -- Suite 330, Boston, MA 02111-1307, USA.
142
 
142
 
143
1.2 Obtaining this document
143
1.2 Obtaining this document
144
===========================
144
===========================
145
 
145
 
146
The latest version of this document is always available from
146
The latest version of this document is always available from
147
 
147
 
148
     `http://www.ci.tuwien.ac.at/~hornik/R/'
148
     `http://www.ci.tuwien.ac.at/~hornik/R/'
149
 
149
 
150
   From there, you can obtain versions converted to plain ASCII text, DVI,
150
   From there, you can obtain versions converted to plain ASCII text, DVI,
151
GNU info, HTML, PDF, PostScript as well as the Texinfo source used for
151
GNU info, HTML, PDF, PostScript as well as the Texinfo source used for
152
creating all these formats using the GNU Texinfo system
152
creating all these formats using the GNU Texinfo system
153
(http://texinfo.org/).
153
(http://texinfo.org/).
154
 
154
 
155
   You can also obtain the R FAQ from the `doc/FAQ' subdirectory of a CRAN
155
   You can also obtain the R FAQ from the `doc/FAQ' subdirectory of a CRAN
156
site (*note What is CRAN?::).
156
site (*note What is CRAN?::).
157
 
157
 
158
1.3 Citing this document
158
1.3 Citing this document
159
========================
159
========================
160
 
160
 
161
In publications, please refer to this FAQ as Hornik (2004), "The R FAQ",
161
In publications, please refer to this FAQ as Hornik (2004), "The R FAQ",
162
and give the above, _official_ URL and the ISBN 3-900051-01-1.
162
and give the above, _official_ URL and the ISBN 3-900051-01-1.
163
 
163
 
164
1.4 Notation
164
1.4 Notation
165
============
165
============
166
 
166
 
167
Everything should be pretty standard.  `R>' is used for the R prompt, and a
167
Everything should be pretty standard.  `R>' is used for the R prompt, and a
168
`$' for the shell prompt (where applicable).
168
`$' for the shell prompt (where applicable).
169
 
169
 
170
1.5 Feedback
170
1.5 Feedback
171
============
171
============
172
 
172
 
173
Feedback is of course most welcome.
173
Feedback is of course most welcome.
174
 
174
 
175
   In particular, note that I do not have access to Windows or Macintosh
175
   In particular, note that I do not have access to Windows or Macintosh
176
systems.  Features specific to the Windows and MacOS X ports of R are
176
systems.  Features specific to the Windows and MacOS X ports of R are
177
described in the "R for Windows FAQ"
177
described in the "R for Windows FAQ"
178
(http://www.stats.ox.ac.uk/pub/R/rw-FAQ.html) and the "R for Macintosh
178
(http://www.stats.ox.ac.uk/pub/R/rw-FAQ.html) and the "R for Macintosh
179
FAQ/DOC" (http://cran.r-project.org/bin/macosx/RAqua-FAQ.html).  If you
179
FAQ/DOC" (http://cran.r-project.org/bin/macosx/RAqua-FAQ.html).  If you
180
have information on Macintosh or Windows systems that you think should be
180
have information on Macintosh or Windows systems that you think should be
181
added to this document, please let me know.
181
added to this document, please let me know.
182
 
182
 
183
2 R Basics
183
2 R Basics
184
**********
184
**********
185
 
185
 
186
2.1 What is R?
186
2.1 What is R?
187
==============
187
==============
188
 
188
 
189
R is a system for statistical computation and graphics.  It consists of a
189
R is a system for statistical computation and graphics.  It consists of a
190
language plus a run-time environment with graphics, a debugger, access to
190
language plus a run-time environment with graphics, a debugger, access to
191
certain system functions, and the ability to run programs stored in script
191
certain system functions, and the ability to run programs stored in script
192
files.
192
files.
193
 
193
 
194
   The design of R has been heavily influenced by two existing languages:
194
   The design of R has been heavily influenced by two existing languages:
195
Becker, Chambers & Wilks' S (*note What is S?::) and Sussman's Scheme
195
Becker, Chambers & Wilks' S (*note What is S?::) and Sussman's Scheme
196
(http://www.cs.indiana.edu/scheme-repository/home.html).  Whereas the
196
(http://www.cs.indiana.edu/scheme-repository/home.html).  Whereas the
197
resulting language is very similar in appearance to S, the underlying
197
resulting language is very similar in appearance to S, the underlying
198
implementation and semantics are derived from Scheme.  *Note What are the
198
implementation and semantics are derived from Scheme.  *Note What are the
199
differences between R and S?::, for further details.
199
differences between R and S?::, for further details.
200
 
200
 
201
   The core of R is an interpreted computer language which allows branching
201
   The core of R is an interpreted computer language which allows branching
202
and looping as well as modular programming using functions.  Most of the
202
and looping as well as modular programming using functions.  Most of the
203
user-visible functions in R are written in R.  It is possible for the user
203
user-visible functions in R are written in R.  It is possible for the user
204
to interface to procedures written in the C, C++, or FORTRAN languages for
204
to interface to procedures written in the C, C++, or FORTRAN languages for
205
efficiency.  The R distribution contains functionality for a large number
205
efficiency.  The R distribution contains functionality for a large number
206
of statistical procedures.  Among these are: linear and generalized linear
206
of statistical procedures.  Among these are: linear and generalized linear
207
models, nonlinear regression models, time series analysis, classical
207
models, nonlinear regression models, time series analysis, classical
208
parametric and nonparametric tests, clustering and smoothing.  There is
208
parametric and nonparametric tests, clustering and smoothing.  There is
209
also a large set of functions which provide a flexible graphical
209
also a large set of functions which provide a flexible graphical
210
environment for creating various kinds of data presentations.  Additional
210
environment for creating various kinds of data presentations.  Additional
211
modules ("add-on packages") are available for a variety of specific
211
modules ("add-on packages") are available for a variety of specific
212
purposes (*note R Add-On Packages::).
212
purposes (*note R Add-On Packages::).
213
 
213
 
214
   R was initially written by Ross Ihaka <Ross.Ihaka@R-project.org> and
214
   R was initially written by Ross Ihaka <Ross.Ihaka@R-project.org> and
215
Robert Gentleman <Robert.Gentleman@R-project.org> at the Department of
215
Robert Gentleman <Robert.Gentleman@R-project.org> at the Department of
216
Statistics of the University of Auckland in Auckland, New Zealand.  In
216
Statistics of the University of Auckland in Auckland, New Zealand.  In
217
addition, a large group of individuals has contributed to R by sending code
217
addition, a large group of individuals has contributed to R by sending code
218
and bug reports.
218
and bug reports.
219
 
219
 
220
   Since mid-1997 there has been a core group (the "R Core Team") who can
220
   Since mid-1997 there has been a core group (the "R Core Team") who can
221
modify the R source code CVS archive.  The group currently consists of Doug
221
modify the R source code CVS archive.  The group currently consists of Doug
222
Bates, John Chambers, Peter Dalgaard, Robert Gentleman, Kurt Hornik,
222
Bates, John Chambers, Peter Dalgaard, Robert Gentleman, Kurt Hornik,
223
Stefano Iacus, Ross Ihaka, Friedrich Leisch, Thomas Lumley, Martin
223
Stefano Iacus, Ross Ihaka, Friedrich Leisch, Thomas Lumley, Martin
224
Maechler, Duncan Murdoch, Paul Murrell, Martyn Plummer, Brian Ripley,
224
Maechler, Duncan Murdoch, Paul Murrell, Martyn Plummer, Brian Ripley,
225
Duncan Temple Lang, and Luke Tierney.
225
Duncan Temple Lang, and Luke Tierney.
226
 
226
 
227
   R has a home page at `http://www.R-project.org/'.  It is free software
227
   R has a home page at `http://www.R-project.org/'.  It is free software
228
distributed under a GNU-style copyleft, and an official part of the GNU
228
distributed under a GNU-style copyleft, and an official part of the GNU
229
project ("GNU S").
229
project ("GNU S").
230
 
230
 
231
2.2 What machines does R run on?
231
2.2 What machines does R run on?
232
================================
232
================================
233
 
233
 
234
R is being developed for the Unix, Windows and Mac families of operating
234
R is being developed for the Unix, Windows and Mac families of operating
235
systems.  Support for Mac OS Classic will end with the 1.7 series.
235
systems.  Support for Mac OS Classic will end with the 1.7 series.
236
 
236
 
237
   The current version of R will configure and build under a number of
237
   The current version of R will configure and build under a number of
238
common Unix platforms including i386-freebsd, CPU-linux-gnu for the i386,
238
common Unix platforms including i386-freebsd, CPU-linux-gnu for the i386,
239
alpha, arm, hppa, ia64, m68k, powerpc, and sparc CPUs (see e.g.
239
alpha, arm, hppa, ia64, m68k, powerpc, and sparc CPUs (see e.g.
240
`http://buildd.debian.org/build.php?&pkg=r-base'), i386-sun-solaris,
240
`http://buildd.debian.org/build.php?&pkg=r-base'), i386-sun-solaris,
241
powerpc-apple-darwin, mips-sgi-irix, alpha-dec-osf4, rs6000-ibm-aix,
241
powerpc-apple-darwin, mips-sgi-irix, alpha-dec-osf4, rs6000-ibm-aix,
242
hppa-hp-hpux, and sparc-sun-solaris.
242
hppa-hp-hpux, and sparc-sun-solaris.
243
 
243
 
244
   If you know about other platforms, please drop us a note.
244
   If you know about other platforms, please drop us a note.
245
 
245
 
246
2.3 What is the current version of R?
246
2.3 What is the current version of R?
247
=====================================
247
=====================================
248
 
248
 
249
The current released version is 1.8.1.  Based on this
249
The current released version is 1.8.1.  Based on this
250
`major.minor.patchlevel' numbering scheme, there are two development
250
`major.minor.patchlevel' numbering scheme, there are two development
251
versions of R, working towards the next patch (`r-patched') and minor or
251
versions of R, working towards the next patch (`r-patched') and minor or
252
eventually major (`r-devel') releases of R, respectively.  Version
252
eventually major (`r-devel') releases of R, respectively.  Version
253
r-patched is for bug fixes mostly.  New features are typically introduced
253
r-patched is for bug fixes mostly.  New features are typically introduced
254
in r-devel.
254
in r-devel.
255
 
255
 
256
2.4 How can R be obtained?
256
2.4 How can R be obtained?
257
==========================
257
==========================
258
 
258
 
259
Sources, binaries and documentation for R can be obtained via CRAN, the
259
Sources, binaries and documentation for R can be obtained via CRAN, the
260
"Comprehensive R Archive Network" (see *Note What is CRAN?::).
260
"Comprehensive R Archive Network" (see *Note What is CRAN?::).
261
 
261
 
262
   Sources are also available via anonymous rsync.  Use
262
   Sources are also available via anonymous rsync.  Use
263
 
263
 
264
     rsync -rC --delete rsync.R-project.org::MODULE R
264
     rsync -rC --delete rsync.R-project.org::MODULE R
265
 
265
 
266
to create a copy of the source tree specified by MODULE in the subdirectory
266
to create a copy of the source tree specified by MODULE in the subdirectory
267
`R' of the current directory, where MODULE specifies one of the three
267
`R' of the current directory, where MODULE specifies one of the three
268
existing flavors of the R sources, and can be one of `r-release' (current
268
existing flavors of the R sources, and can be one of `r-release' (current
269
released version), `r-patched' (patched released version), and `r-devel'
269
released version), `r-patched' (patched released version), and `r-devel'
270
(development version).  The rsync trees are created directly from the
270
(development version).  The rsync trees are created directly from the
271
master CVS archive and are updated hourly.  The `-C' and in the `rsync'
271
master CVS archive and are updated hourly.  The `-C' and in the `rsync'
272
command is to cause it to skip the CVS directories.  Further information on
272
command is to cause it to skip the CVS directories.  Further information on
273
`rsync' is available at `http://rsync.samba.org/rsync/'.
273
`rsync' is available at `http://rsync.samba.org/rsync/'.
274
 
274
 
275
   The sources of the development version are also available via anonymous
275
   The sources of the development version are also available via anonymous
276
CVS.  See `http://anoncvs.R-project.org' for more information.
276
CVS.  See `http://anoncvs.R-project.org' for more information.
277
 
277
 
278
2.5 How can R be installed?
278
2.5 How can R be installed?
279
===========================
279
===========================
280
 
280
 
281
2.5.1 How can R be installed (Unix)
281
2.5.1 How can R be installed (Unix)
282
-----------------------------------
282
-----------------------------------
283
 
283
 
284
If binaries are available for your platform (see *Note Are there Unix
284
If binaries are available for your platform (see *Note Are there Unix
285
binaries for R?::), you can use these, following the instructions that come
285
binaries for R?::), you can use these, following the instructions that come
286
with them.
286
with them.
287
 
287
 
288
   Otherwise, you can compile and install R yourself, which can be done
288
   Otherwise, you can compile and install R yourself, which can be done
289
very easily under a number of common Unix platforms (see *Note What
289
very easily under a number of common Unix platforms (see *Note What
290
machines does R run on?::).  The file `INSTALL' that comes with the R
290
machines does R run on?::).  The file `INSTALL' that comes with the R
291
distribution contains a brief introduction, and the "R Installation and
291
distribution contains a brief introduction, and the "R Installation and
292
Administration" guide (*note What documentation exists for R?::) has full
292
Administration" guide (*note What documentation exists for R?::) has full
293
details.
293
details.
294
 
294
 
295
   Note that you need a FORTRAN compiler or `f2c' in addition to a C
295
   Note that you need a FORTRAN compiler or `f2c' in addition to a C
296
compiler to build R.  Also, you need Perl version 5 to build the R object
296
compiler to build R.  Also, you need Perl version 5 to build the R object
297
documentations.  (If this is not available on your system, you can obtain a
297
documentations.  (If this is not available on your system, you can obtain a
298
PDF version of the object reference manual via CRAN.)
298
PDF version of the object reference manual via CRAN.)
299
 
299
 
300
   In the simplest case, untar the R source code, change to the directory
300
   In the simplest case, untar the R source code, change to the directory
301
thus created, and issue the following commands (at the shell prompt):
301
thus created, and issue the following commands (at the shell prompt):
302
 
302
 
303
     $ ./configure
303
     $ ./configure
304
     $ make
304
     $ make
305
 
305
 
306
   If these commands execute successfully, the R binary and a shell script
306
   If these commands execute successfully, the R binary and a shell script
307
front-end called `R' are created and copied to the `bin' directory.  You
307
front-end called `R' are created and copied to the `bin' directory.  You
308
can copy the script to a place where users can invoke it, for example to
308
can copy the script to a place where users can invoke it, for example to
309
`/usr/local/bin'.  In addition, plain text help pages as well as HTML and
309
`/usr/local/bin'.  In addition, plain text help pages as well as HTML and
310
LaTeX versions of the documentation are built.
310
LaTeX versions of the documentation are built.
311
 
311
 
312
   Use `make dvi' to create DVI versions of the R manuals, such as
312
   Use `make dvi' to create DVI versions of the R manuals, such as
313
`refman.dvi' (an R object reference index) and `R-exts.dvi', the "R
313
`refman.dvi' (an R object reference index) and `R-exts.dvi', the "R
314
Extension Writers Guide", in the `doc/manual' subdirectory.  These files
314
Extension Writers Guide", in the `doc/manual' subdirectory.  These files
315
can be previewed and printed using standard programs such as `xdvi' and
315
can be previewed and printed using standard programs such as `xdvi' and
316
`dvips'.  You can also use `make pdf' to build PDF (Portable Document
316
`dvips'.  You can also use `make pdf' to build PDF (Portable Document
317
Format) version of the manuals, and view these using e.g. Acrobat.  Manuals
317
Format) version of the manuals, and view these using e.g. Acrobat.  Manuals
318
written in the GNU Texinfo system can also be converted to info files
318
written in the GNU Texinfo system can also be converted to info files
319
suitable for reading online with Emacs or stand-alone GNU Info; use `make
319
suitable for reading online with Emacs or stand-alone GNU Info; use `make
320
info' to create these versions (note that this requires `makeinfo' version
320
info' to create these versions (note that this requires `makeinfo' version
321
4).
321
4).
322
 
322
 
323
   Finally, use `make check' to find out whether your R system works
323
   Finally, use `make check' to find out whether your R system works
324
correctly.
324
correctly.
325
 
325
 
326
   You can also perform a "system-wide" installation using `make install'.
326
   You can also perform a "system-wide" installation using `make install'.
327
By default, this will install to the following directories:
327
By default, this will install to the following directories:
328
 
328
 
329
`${prefix}/bin'
329
`${prefix}/bin'
330
     the front-end shell script
330
     the front-end shell script
331
 
331
 
332
`${prefix}/man/man1'
332
`${prefix}/man/man1'
333
     the man page
333
     the man page
334
 
334
 
335
`${prefix}/lib/R'
335
`${prefix}/lib/R'
336
     all the rest (libraries, on-line help system, ...).  This is the "R
336
     all the rest (libraries, on-line help system, ...).  This is the "R
337
     Home Directory" (`R_HOME') of the installed system.
337
     Home Directory" (`R_HOME') of the installed system.
338
 
338
 
339
In the above, `prefix' is determined during configuration (typically
339
In the above, `prefix' is determined during configuration (typically
340
`/usr/local') and can be set by running `configure' with the option
340
`/usr/local') and can be set by running `configure' with the option
341
 
341
 
342
     $ ./configure --prefix=/where/you/want/R/to/go
342
     $ ./configure --prefix=/where/you/want/R/to/go
343
 
343
 
344
(E.g., the R executable will then be installed into
344
(E.g., the R executable will then be installed into
345
`/where/you/want/R/to/go/bin'.)
345
`/where/you/want/R/to/go/bin'.)
346
 
346
 
347
   To install DVI, info and PDF versions of the manuals, use `make
347
   To install DVI, info and PDF versions of the manuals, use `make
348
install-dvi', `make install-info' and `make install-pdf', respectively.
348
install-dvi', `make install-info' and `make install-pdf', respectively.
349
 
349
 
350
2.5.2 How can R be installed (Windows)
350
2.5.2 How can R be installed (Windows)
351
--------------------------------------
351
--------------------------------------
352
 
352
 
353
The `bin/windows' directory of a CRAN site contains binaries for a base
353
The `bin/windows' directory of a CRAN site contains binaries for a base
354
distribution and a large number of add-on packages from CRAN to run on
354
distribution and a large number of add-on packages from CRAN to run on
355
Windows 95, 98, ME, NT4, 2000, and XP (at least) on Intel and clones (but
355
Windows 95, 98, ME, NT4, 2000, and XP (at least) on Intel and clones (but
356
not on other platforms).  The Windows version of R was created by Robert
356
not on other platforms).  The Windows version of R was created by Robert
357
Gentleman, and is now being developed and maintained by Duncan Murdoch
357
Gentleman, and is now being developed and maintained by Duncan Murdoch
358
<murdoch@stats.uwo.ca> and Brian D. Ripley <Brian.Ripley@R-project.org>.
358
<murdoch@stats.uwo.ca> and Brian D. Ripley <Brian.Ripley@R-project.org>.
359
 
359
 
360
   For most installations the Windows installer program will be the easiest
360
   For most installations the Windows installer program will be the easiest
361
tool to use.
361
tool to use.
362
 
362
 
363
   See the "R for Windows FAQ"
363
   See the "R for Windows FAQ"
364
(http://www.stats.ox.ac.uk/pub/R/rw-FAQ.html) for more details.
364
(http://www.stats.ox.ac.uk/pub/R/rw-FAQ.html) for more details.
365
 
365
 
366
2.5.3 How can R be installed (Macintosh)
366
2.5.3 How can R be installed (Macintosh)
367
----------------------------------------
367
----------------------------------------
368
 
368
 
369
The `bin/macosx' directory of a CRAN site contains a standard Apple
369
The `bin/macosx' directory of a CRAN site contains a standard Apple
370
installer package named `RAqua.pkg.sit' compressed in Aladdin Stuffit
370
installer package named `RAqua.pkg.sit' compressed in Aladdin Stuffit
371
format.  Once downloaded, uncompressed and executed, the installer will
371
format.  Once downloaded, uncompressed and executed, the installer will
372
install the current non-developer release of R.  RAqua is a native MacOSX
372
install the current non-developer release of R.  RAqua is a native MacOSX
373
Darwin version of R with an Aqua GUI.  Inside `bin/macosx/X.Y' there are
373
Darwin version of R with an Aqua GUI.  Inside `bin/macosx/X.Y' there are
374
prebuilt binary packages to be used with RAqua corresponding to the "X.Y"
374
prebuilt binary packages to be used with RAqua corresponding to the "X.Y"
375
release of R. The installation of these packages is available through the
375
release of R. The installation of these packages is available through the
376
"Package" menu of the RAqua GUI.  This port of R for MacOSX is maintained
376
"Package" menu of the RAqua GUI.  This port of R for MacOSX is maintained
377
by Stefano Iacus <Stefano.Iacus@R-project.org>.  The "R for Macintosh
377
by Stefano Iacus <Stefano.Iacus@R-project.org>.  The "R for Macintosh
378
FAQ/DOC" (http://cran.r-project.org/bin/macosx/RAqua-FAQ.html) has more
378
FAQ/DOC" (http://cran.r-project.org/bin/macosx/RAqua-FAQ.html) has more
379
details.
379
details.
380
 
380
 
381
   The `bin/macos' directory of a CRAN site contains bin-hexed (`hqx') and
381
   The `bin/macos' directory of a CRAN site contains bin-hexed (`hqx') and
382
stuffit (`sit') archives for a base distribution and a large number of
382
stuffit (`sit') archives for a base distribution and a large number of
383
add-on packages of R 1.7.1 to run under MacOS 8.6 to MacOS 9.2.2.  This
383
add-on packages of R 1.7.1 to run under MacOS 8.6 to MacOS 9.2.2.  This
384
port of R for Macintosh is no longer supported.
384
port of R for Macintosh is no longer supported.
385
 
385
 
386
2.6 Are there Unix binaries for R?
386
2.6 Are there Unix binaries for R?
387
==================================
387
==================================
388
 
388
 
389
The `bin/linux' directory of a CRAN site contains Debian
389
The `bin/linux' directory of a CRAN site contains Debian
390
stable/testing/unstable packages for the i386 platform (now part of the
390
stable/testing/unstable packages for the i386 platform (now part of the
391
Debian distribution and maintained by Dirk Eddelbuettel), Mandrake 9.0/9.1
391
Debian distribution and maintained by Dirk Eddelbuettel), Mandrake 9.0/9.1
392
i386 packages by Michele Alzetta, Red Hat 7.x/8.x/9 i386 packages by Martyn
392
i386 packages by Michele Alzetta, Red Hat 7.x/8.x/9 i386 packages by Martyn
393
Plummer, SuSE 7.3/8.0/8.1/8.2/9.0 i386 packages by Detlef Steuer, and
393
Plummer, SuSE 7.3/8.0/8.1/8.2/9.0 i386 packages by Detlef Steuer, and
394
VineLinux 2.6 i386 packages by Susunu Tanimura.
394
VineLinux 2.6 i386 packages by Susunu Tanimura.
395
 
395
 
396
   The Debian packages can be accessed through APT, the Debian package
396
   The Debian packages can be accessed through APT, the Debian package
397
maintenance tool.  Simply add the line
397
maintenance tool.  Simply add the line
398
 
398
 
399
     deb http://cran.R-project.org/bin/linux/debian DISTRIBUTION main
399
     deb http://cran.R-project.org/bin/linux/debian DISTRIBUTION main
400
 
400
 
401
(where DISTRIBUTION is either `stable' or `testing'; feel free to use a
401
(where DISTRIBUTION is either `stable' or `testing'; feel free to use a
402
CRAN mirror instead of the master) to the file `/etc/apt/sources.list'.
402
CRAN mirror instead of the master) to the file `/etc/apt/sources.list'.
403
Once you have added that line the programs `apt-get', `apt-cache', and
403
Once you have added that line the programs `apt-get', `apt-cache', and
404
`dselect' (using the apt access method) will automatically detect and
404
`dselect' (using the apt access method) will automatically detect and
405
install updates of the R packages.
405
install updates of the R packages.
406
 
406
 
407
   No other binary distributions are currently publically available.
407
   No other binary distributions are currently publically available.
408
 
408
 
409
2.7 What documentation exists for R?
409
2.7 What documentation exists for R?
410
====================================
410
====================================
411
 
411
 
412
Online documentation for most of the functions and variables in R exists,
412
Online documentation for most of the functions and variables in R exists,
413
and can be printed on-screen by typing `help(NAME)' (or `?NAME') at the R
413
and can be printed on-screen by typing `help(NAME)' (or `?NAME') at the R
414
prompt, where NAME is the name of the topic help is sought for.  (In the
414
prompt, where NAME is the name of the topic help is sought for.  (In the
415
case of unary and binary operators and control-flow special forms, the name
415
case of unary and binary operators and control-flow special forms, the name
416
may need to be be quoted.)
416
may need to be be quoted.)
417
 
417
 
418
   This documentation can also be made available as one reference manual
418
   This documentation can also be made available as one reference manual
419
for on-line reading in HTML and PDF formats, and as hardcopy via LaTeX, see
419
for on-line reading in HTML and PDF formats, and as hardcopy via LaTeX, see
420
*Note How can R be installed?::.  An up-to-date HTML version is always
420
*Note How can R be installed?::.  An up-to-date HTML version is always
421
available for web browsing at `http://stat.ethz.ch/R-manual/'.
421
available for web browsing at `http://stat.ethz.ch/R-manual/'.
422
 
422
 
423
   The R distribution also comes with the following manuals.
423
   The R distribution also comes with the following manuals.
424
 
424
 
425
   * "An Introduction to R" (`R-intro') includes information on data types,
425
   * "An Introduction to R" (`R-intro') includes information on data types,
426
     programming elements, statistical modeling and graphics.  This
426
     programming elements, statistical modeling and graphics.  This
427
     document is based on the "Notes on S-PLUS" by Bill Venables and David
427
     document is based on the "Notes on S-PLUS" by Bill Venables and David
428
     Smith.
428
     Smith.
429
 
429
 
430
   * "Writing R Extensions" (`R-exts') currently describes the process of
430
   * "Writing R Extensions" (`R-exts') currently describes the process of
431
     creating R add-on packages, writing R documentation, R's system and
431
     creating R add-on packages, writing R documentation, R's system and
432
     foreign language interfaces, and the R API.
432
     foreign language interfaces, and the R API.
433
 
433
 
434
   * "R Data Import/Export" (`R-data') is a guide to importing and
434
   * "R Data Import/Export" (`R-data') is a guide to importing and
435
     exporting data to and from R.
435
     exporting data to and from R.
436
 
436
 
437
   * "The R Language Definition" (`R-lang'), a first version of the
437
   * "The R Language Definition" (`R-lang'), a first version of the
438
     "Kernighan & Ritchie of R", explains evaluation, parsing, object
438
     "Kernighan & Ritchie of R", explains evaluation, parsing, object
439
     oriented programming, computing on the language, and so forth.
439
     oriented programming, computing on the language, and so forth.
440
 
440
 
441
   * "R Installation and Administration" (`R-admin').
441
   * "R Installation and Administration" (`R-admin').
442
 
442
 
443
   Books on R include
443
   Books on R include
444
 
444
 
445
     P. Dalgaard (2002), "Introductory Statistics with R", Springer: New
445
     P. Dalgaard (2002), "Introductory Statistics with R", Springer: New
446
     York, ISBN 0-387-95475-9.
446
     York, ISBN 0-387-95475-9.
447
 
447
 
448
     J. Fox (2002), "An R and S-PLUS Companion to Applied Regression", Sage
448
     J. Fox (2002), "An R and S-PLUS Companion to Applied Regression", Sage
449
     Publications, ISBN 0-761-92280-6 (softcover) or 0-761-92279-2
449
     Publications, ISBN 0-761-92280-6 (softcover) or 0-761-92279-2
450
     (hardcover), `http://socserv.socsci.mcmaster.ca/jfox/Books/Companion/'.
450
     (hardcover), `http://socserv.socsci.mcmaster.ca/jfox/Books/Companion/'.
451
 
451
 
452
     J. Maindonald and J. Braun (2003), "Data Analysis and Graphics Using R:
452
     J. Maindonald and J. Braun (2003), "Data Analysis and Graphics Using R:
453
     An Example-Based Approach", Cambridge University Press, ISBN
453
     An Example-Based Approach", Cambridge University Press, ISBN
454
     0-521-81336-0, `http://wwwmaths.anu.edu.au/~johnm/'.
454
     0-521-81336-0, `http://wwwmaths.anu.edu.au/~johnm/'.
455
 
455
 
456
     S. M. Iacus and G. Masarotto (2002), "Laboratorio di statistica con R
456
     S. M. Iacus and G. Masarotto (2002), "Laboratorio di statistica con R
457
     ", McGraw-Hill, ISBN 88-386-6084-0 (in Italian).
457
     ", McGraw-Hill, ISBN 88-386-6084-0 (in Italian).
458
 
458
 
459
The book
459
The book
460
 
460
 
461
     W. N. Venables and B. D. Ripley (2002), "Modern Applied Statistics with
461
     W. N. Venables and B. D. Ripley (2002), "Modern Applied Statistics with
462
     S.  Fourth Edition".  Springer, ISBN 0-387-95457-0
462
     S.  Fourth Edition".  Springer, ISBN 0-387-95457-0
463
 
463
 
464
has a home page at `http://www.stats.ox.ac.uk/pub/MASS4/' providing
464
has a home page at `http://www.stats.ox.ac.uk/pub/MASS4/' providing
465
additional material.  Its companion is
465
additional material.  Its companion is
466
 
466
 
467
     W. N. Venables and B. D. Ripley (2000), "S Programming".  Springer,
467
     W. N. Venables and B. D. Ripley (2000), "S Programming".  Springer,
468
     ISBN 0-387-98966-8
468
     ISBN 0-387-98966-8
469
 
469
 
470
and provides an in-depth guide to writing software in the S language which
470
and provides an in-depth guide to writing software in the S language which
471
forms the basis of both the commercial S-PLUS and the Open Source R data
471
forms the basis of both the commercial S-PLUS and the Open Source R data
472
analysis software systems.  See
472
analysis software systems.  See
473
`http://www.stats.ox.ac.uk/pub/MASS3/Sprog/' for more information.
473
`http://www.stats.ox.ac.uk/pub/MASS3/Sprog/' for more information.
474
 
474
 
475
   In addition to material written specifically or explicitly for R,
475
   In addition to material written specifically or explicitly for R,
476
documentation for S/S-PLUS (see *Note R and S::) can be used in combination
476
documentation for S/S-PLUS (see *Note R and S::) can be used in combination
477
with this FAQ (*note What are the differences between R and S?::).
477
with this FAQ (*note What are the differences between R and S?::).
478
Introductory books include
478
Introductory books include
479
 
479
 
480
     P. Spector (1994), "An introduction to S and S-PLUS", Duxbury Press.
480
     P. Spector (1994), "An introduction to S and S-PLUS", Duxbury Press.
481
 
481
 
482
     A. Krause and M. Olsen (2002), "The Basics of S-PLUS" (Third Edition).
482
     A. Krause and M. Olsen (2002), "The Basics of S-PLUS" (Third Edition).
483
     Springer, ISBN 0-387-95456-2
483
     Springer, ISBN 0-387-95456-2
484
 
484
 
485
   The book
485
   The book
486
 
486
 
487
     J. C. Pinheiro and D. M. Bates (2000), "Mixed-Effects Models in S and
487
     J. C. Pinheiro and D. M. Bates (2000), "Mixed-Effects Models in S and
488
     S-PLUS", Springer, ISBN 0-387-98957-0
488
     S-PLUS", Springer, ISBN 0-387-98957-0
489
 
489
 
490
provides a comprehensive guide to the use of the *nlme* package for linear
490
provides a comprehensive guide to the use of the *nlme* package for linear
491
and nonlinear mixed-effects models.  This has a home page at
491
and nonlinear mixed-effects models.  This has a home page at
492
`http://nlme.stat.wisc.edu/MEMSS/'.
492
`http://nlme.stat.wisc.edu/MEMSS/'.
493
 
493
 
494
   As an example of how R can be used in teaching an advanced introductory
494
   As an example of how R can be used in teaching an advanced introductory
495
statistics course, see
495
statistics course, see
496
 
496
 
497
     D. Nolan and T. Speed (2000), "Stat Labs: Mathematical Statistics
497
     D. Nolan and T. Speed (2000), "Stat Labs: Mathematical Statistics
498
     Through Applications", Springer Texts in Statistics, ISBN 0-387-98974-9
498
     Through Applications", Springer Texts in Statistics, ISBN 0-387-98974-9
499
 
499
 
500
This integrates theory of statistics with the practice of statistics
500
This integrates theory of statistics with the practice of statistics
501
through a collection of case studies ("labs"), and uses R to analyze the
501
through a collection of case studies ("labs"), and uses R to analyze the
502
data.  More information can be found at
502
data.  More information can be found at
503
`http://www.stat.Berkeley.EDU/users/statlabs/'.
503
`http://www.stat.Berkeley.EDU/users/statlabs/'.
504
 
504
 
505
   Last, but not least, Ross' and Robert's experience in designing and
505
   Last, but not least, Ross' and Robert's experience in designing and
506
implementing R is described in Ihaka & Gentleman (1996), "R: A Language for
506
implementing R is described in Ihaka & Gentleman (1996), "R: A Language for
507
Data Analysis and Graphics", _Journal of Computational and Graphical
507
Data Analysis and Graphics", _Journal of Computational and Graphical
508
Statistics_, *5*, 299-314.
508
Statistics_, *5*, 299-314.
509
 
509
 
510
   An annotated bibliography (BibTeX format) of R-related publications
510
   An annotated bibliography (BibTeX format) of R-related publications
511
which includes most of the above references can be found at
511
which includes most of the above references can be found at
512
 
512
 
513
     `http://www.R-project.org/doc/bib/R.bib'
513
     `http://www.R-project.org/doc/bib/R.bib'
514
 
514
 
515
2.8 Citing R
515
2.8 Citing R
516
============
516
============
517
 
517
 
518
To cite R in publications, use
518
To cite R in publications, use
519
 
519
 
520
     @Manual{,
520
     @Manual{,
521
       title        = {R: A language and environment for statistical
521
       title        = {R: A language and environment for statistical
522
                       computing},
522
                       computing},
523
       author       = {{R Development Core Team}},
523
       author       = {{R Development Core Team}},
524
       organization = {R Foundation for Statistical Computing},
524
       organization = {R Foundation for Statistical Computing},
525
       address      = {Vienna, Austria},
525
       address      = {Vienna, Austria},
526
       year         = 2003,
526
       year         = 2003,
527
       note         = {ISBN 3-900051-00-3},
527
       note         = {ISBN 3-900051-00-3},
528
       url          = {http://www.R-project.org}
528
       url          = {http://www.R-project.org}
529
     }
529
     }
530
 
530
 
531
2.9 What mailing lists exist for R?
531
2.9 What mailing lists exist for R?
532
===================================
532
===================================
533
 
533
 
534
Thanks to Martin Maechler <Martin.Maechler@R-project.org>, there are four
534
Thanks to Martin Maechler <Martin.Maechler@R-project.org>, there are four
535
mailing lists devoted to R.
535
mailing lists devoted to R.
536
 
536
 
537
`R-announce'
537
`R-announce'
538
     A moderated list for announcements about the development of R and the
538
     A moderated list for announcements about the development of R and the
539
     availability of new code.
539
     availability of new code.
540
 
540
 
541
`R-packages'
541
`R-packages'
542
     A moderated list for announcements on the availability of new or
542
     A moderated list for announcements on the availability of new or
543
     enhanced contributed packages.
543
     enhanced contributed packages.
544
 
544
 
545
`R-help'
545
`R-help'
546
     The `main' R mailing list, for discussion about problems and solutions
546
     The `main' R mailing list, for discussion about problems and solutions
547
     using R, announcements (not covered by `R-announce' and `R-packages')
547
     using R, announcements (not covered by `R-announce' and `R-packages')
548
     about the development of R and the availability of new code,
548
     about the development of R and the availability of new code,
549
     enhancements and patches to the source code and documentation of R,
549
     enhancements and patches to the source code and documentation of R,
550
     comparison and compatibility with S and S-PLUS, and for the posting of
550
     comparison and compatibility with S and S-PLUS, and for the posting of
551
     nice examples and benchmarks.
551
     nice examples and benchmarks.
552
 
552
 
553
`R-devel'
553
`R-devel'
554
     This list is for discussions about the future of R and pre-testing of
554
     This list is for discussions about the future of R and pre-testing of
555
     new versions.  It is meant for those who maintain an active position in
555
     new versions.  It is meant for those who maintain an active position in
556
     the development of R.
556
     the development of R.
557
 
557
 
558
Note that the R-announce and R-packages lists are gatewayed into R-help.
558
Note that the R-announce and R-packages lists are gatewayed into R-help.
559
Hence, you should subscribe to either of them only in case you are not
559
Hence, you should subscribe to either of them only in case you are not
560
subscribed to R-help.
560
subscribed to R-help.
561
 
561
 
562
   Send email to <R-help@lists.R-project.org> to reach everyone on the
562
   Send email to <R-help@lists.R-project.org> to reach everyone on the
563
R-help mailing list.  To subscribe (or unsubscribe) to this list send
563
R-help mailing list.  To subscribe (or unsubscribe) to this list send
564
`subscribe' (or `unsubscribe') in the _body_ of the message (not in the
564
`subscribe' (or `unsubscribe') in the _body_ of the message (not in the
565
subject!) to <R-help-request@lists.R-project.org>.  Information about the
565
subject!) to <R-help-request@lists.R-project.org>.  Information about the
566
list can be obtained by sending an email with `info' as its contents to
566
list can be obtained by sending an email with `info' as its contents to
567
<R-help-request@lists.R-project.org>.
567
<R-help-request@lists.R-project.org>.
568
 
568
 
569
   Subscription and posting to the other lists is done analogously, with
569
   Subscription and posting to the other lists is done analogously, with
570
`R-help' replaced by `R-announce', `R-packages', and `R-devel',
570
`R-help' replaced by `R-announce', `R-packages', and `R-devel',
571
respectively.
571
respectively.
572
 
572
 
573
   Subscriptions to the R-help and R-devel mailing lists are also available
573
   Subscriptions to the R-help and R-devel mailing lists are also available
574
in digest (plain or MIME) format, see the `doc/html/mail.html' file in CRAN
574
in digest (plain or MIME) format, see the `doc/html/mail.html' file in CRAN
575
for more information.
575
for more information.
576
 
576
 
577
   It is recommended that you send mail to R-help rather than only to the R
577
   It is recommended that you send mail to R-help rather than only to the R
578
Core developers (who are also subscribed to the list, of course).  This may
578
Core developers (who are also subscribed to the list, of course).  This may
579
save them precious time they can use for constantly improving R, and will
579
save them precious time they can use for constantly improving R, and will
580
typically also result in much quicker feedback for yourself.
580
typically also result in much quicker feedback for yourself.
581
 
581
 
582
   Of course, in the case of bug reports it would be very helpful to have
582
   Of course, in the case of bug reports it would be very helpful to have
583
code which reliably reproduces the problem.  Also, make sure that you
583
code which reliably reproduces the problem.  Also, make sure that you
584
include information on the system and version of R being used.  See *Note R
584
include information on the system and version of R being used.  See *Note R
585
Bugs:: for more details.
585
Bugs:: for more details.
586
 
586
 
587
   Archives of the above three mailing lists are made available on the net
587
   Archives of the above three mailing lists are made available on the net
588
in a monthly schedule via the `doc/html/mail.html' file in CRAN.
588
in a monthly schedule via the `doc/html/mail.html' file in CRAN.
589
Searchable archives of the lists are available via
589
Searchable archives of the lists are available via
590
`http://maths.newcastle.edu.au/~rking/R/'.
590
`http://maths.newcastle.edu.au/~rking/R/'.
591
 
591
 
592
   The R Core Team can be reached at <R-core@lists.R-project.org> for
592
   The R Core Team can be reached at <R-core@lists.R-project.org> for
593
comments and reports.
593
comments and reports.
594
 
594
 
595
2.10 What is CRAN?
595
2.10 What is CRAN?
596
==================
596
==================
597
 
597
 
598
The "Comprehensive R Archive Network" (CRAN) is a collection of sites which
598
The "Comprehensive R Archive Network" (CRAN) is a collection of sites which
599
carry identical material, consisting of the R distribution(s), the
599
carry identical material, consisting of the R distribution(s), the
600
contributed extensions, documentation for R, and binaries.
600
contributed extensions, documentation for R, and binaries.
601
 
601
 
602
   The CRAN master site at TU Wien, Austria, can be found at the URL
602
   The CRAN master site at TU Wien, Austria, can be found at the URL
603
 
603
 
604
     `http://cran.R-project.org/'
604
     `http://cran.R-project.org/'
605
 
605
 
606
and is currently being mirrored daily at
606
and is currently being mirrored daily at
607
 
607
 
608
     `http://cran.at.R-project.org/'  (TU Wien, Austria)
608
     `http://cran.at.R-project.org/'  (TU Wien, Austria)
609
     `http://cran.au.R-project.org/'  (PlanetMirror, Australia)
609
     `http://cran.au.R-project.org/'  (PlanetMirror, Australia)
610
     `http://cran.br.R-project.org/'  (Universidade Federal de
610
     `http://cran.br.R-project.org/'  (Universidade Federal de
611
                                      Paraná, Brazil)
611
                                      Paraná, Brazil)
612
     `http://cran.ch.R-project.org/'  (ETH Zürich, Switzerland)
612
     `http://cran.ch.R-project.org/'  (ETH Zürich, Switzerland)
613
     `http://cran.de.R-project.org/'  (APP, Germany)
613
     `http://cran.de.R-project.org/'  (APP, Germany)
614
     `http://cran.dk.R-project.org/'  (SunSITE, Denmark)
614
     `http://cran.dk.R-project.org/'  (SunSITE, Denmark)
615
     `http://cran.es.R-project.org/'  (Spanish National Research
615
     `http://cran.es.R-project.org/'  (Spanish National Research
616
                                      Network, Madrid, Spain)
616
                                      Network, Madrid, Spain)
617
     `http://cran.hu.R-project.org/'  (Semmelweis U, Hungary)
617
     `http://cran.hu.R-project.org/'  (Semmelweis U, Hungary)
618
     `http://cran.uk.R-project.org/'  (U of Bristol, United
618
     `http://cran.uk.R-project.org/'  (U of Bristol, United
619
                                      Kingdom)
619
                                      Kingdom)
620
     `http://cran.us.R-project.org/'  (U of Wisconsin, USA)
620
     `http://cran.us.R-project.org/'  (U of Wisconsin, USA)
621
     `http://cran.za.R-project.org/'  (Rhodes U, South Africa)
621
     `http://cran.za.R-project.org/'  (Rhodes U, South Africa)
622
 
622
 
623
Please use the CRAN site closest to you to reduce network load.
623
Please use the CRAN site closest to you to reduce network load.
624
 
624
 
625
   From CRAN, you can obtain the latest official release of R, daily
625
   From CRAN, you can obtain the latest official release of R, daily
626
snapshots of R (copies of the current CVS trees), as gzipped and bzipped
626
snapshots of R (copies of the current CVS trees), as gzipped and bzipped
627
tar files, a wealth of additional contributed code, as well as prebuilt
627
tar files, a wealth of additional contributed code, as well as prebuilt
628
binaries for various operating systems (Linux, MacOS Classic, MacOS X, and
628
binaries for various operating systems (Linux, MacOS Classic, MacOS X, and
629
MS Windows).  CRAN also provides access to documentation on R, existing
629
MS Windows).  CRAN also provides access to documentation on R, existing
630
mailing lists and the R Bug Tracking system.
630
mailing lists and the R Bug Tracking system.
631
 
631
 
632
   To "submit" to CRAN, simply upload to
632
   To "submit" to CRAN, simply upload to
633
`ftp://cran.R-project.org/incoming/' and send an email to
633
`ftp://cran.R-project.org/incoming/' and send an email to
634
<cran@R-project.org>.  Note that CRAN generally does not accept submissions
634
<cran@R-project.org>.  Note that CRAN generally does not accept submissions
635
of precompiled binaries due to security reasons.
635
of precompiled binaries due to security reasons.
636
 
636
 
637
     *Note:*  It is very important that you indicate the copyright
637
     *Note:*  It is very important that you indicate the copyright
638
     (license) information (GPL, BSD, Artistic, ...)  in your submission.
638
     (license) information (GPL, BSD, Artistic, ...)  in your submission.
639
 
639
 
640
   Please always use the URL of the master site when referring to CRAN.
640
   Please always use the URL of the master site when referring to CRAN.
641
 
641
 
642
2.11 Can I use R for commercial purposes?
642
2.11 Can I use R for commercial purposes?
643
=========================================
643
=========================================
644
 
644
 
645
R is released under the GNU General Public License (GPL).  If you have any
645
R is released under the GNU General Public License (GPL).  If you have any
646
questions regarding the legality of using R in any particular situation you
646
questions regarding the legality of using R in any particular situation you
647
should bring it up with your legal counsel.  We are in no position to offer
647
should bring it up with your legal counsel.  We are in no position to offer
648
legal advice.
648
legal advice.
649
 
649
 
650
   It is the opinion of the R Core Team that one can use R for commercial
650
   It is the opinion of the R Core Team that one can use R for commercial
651
purposes (e.g., in business or in consulting).  The GPL, like all Open
651
purposes (e.g., in business or in consulting).  The GPL, like all Open
652
Source licenses, permits all and any use of the package.  It only restricts
652
Source licenses, permits all and any use of the package.  It only restricts
653
distribution of R or of other programs containing code from R.  This is
653
distribution of R or of other programs containing code from R.  This is
654
made clear in clause 6 ("No Discrimination Against Fields of Endeavor") of
654
made clear in clause 6 ("No Discrimination Against Fields of Endeavor") of
655
the Open Source Definition (http://www.opensource.org/docs/definition.html):
655
the Open Source Definition (http://www.opensource.org/docs/definition.html):
656
 
656
 
657
     The license must not restrict anyone from making use of the program in
657
     The license must not restrict anyone from making use of the program in
658
     a specific field of endeavor.  For example, it may not restrict the
658
     a specific field of endeavor.  For example, it may not restrict the
659
     program from being used in a business, or from being used for genetic
659
     program from being used in a business, or from being used for genetic
660
     research.
660
     research.
661
 
661
 
662
It is also explicitly stated in clause 0 of the GPL, which says in part
662
It is also explicitly stated in clause 0 of the GPL, which says in part
663
 
663
 
664
     Activities other than copying, distribution and modification are not
664
     Activities other than copying, distribution and modification are not
665
     covered by this License; they are outside its scope.  The act of
665
     covered by this License; they are outside its scope.  The act of
666
     running the Program is not restricted, and the output from the Program
666
     running the Program is not restricted, and the output from the Program
667
     is covered only if its contents constitute a work based on the Program.
667
     is covered only if its contents constitute a work based on the Program.
668
 
668
 
669
   Most add-on packages, including all recommended ones, also explicitly
669
   Most add-on packages, including all recommended ones, also explicitly
670
allow commercial use in this way.  A few packages are restricted to
670
allow commercial use in this way.  A few packages are restricted to
671
"non-commercial use"; you should contact the author to clarify whether
671
"non-commercial use"; you should contact the author to clarify whether
672
these may be used or seek the advice of your legal counsel.
672
these may be used or seek the advice of your legal counsel.
673
 
673
 
674
   None of the discussion in this section constitutes legal advice.  The R
674
   None of the discussion in this section constitutes legal advice.  The R
675
Core Team does not provide legal advice under any circumstances.
675
Core Team does not provide legal advice under any circumstances.
676
 
676
 
677
2.12 Why is R named R?
677
2.12 Why is R named R?
678
======================
678
======================
679
 
679
 
680
The name is partly based on the (first) names of the first two R authors
680
The name is partly based on the (first) names of the first two R authors
681
(Robert Gentleman and Ross Ihaka), and partly a play on the name of the
681
(Robert Gentleman and Ross Ihaka), and partly a play on the name of the
682
Bell Labs language `S' (*note What is S?::).
682
Bell Labs language `S' (*note What is S?::).
683
 
683
 
684
3 R and S
684
3 R and S
685
*********
685
*********
686
 
686
 
687
3.1 What is S?
687
3.1 What is S?
688
==============
688
==============
689
 
689
 
690
S is a very high level language and an environment for data analysis and
690
S is a very high level language and an environment for data analysis and
691
graphics.  In 1998, the Association for Computing Machinery (ACM) presented
691
graphics.  In 1998, the Association for Computing Machinery (ACM) presented
692
its Software System Award to John M. Chambers, the principal designer of S,
692
its Software System Award to John M. Chambers, the principal designer of S,
693
for
693
for
694
 
694
 
695
     the S system, which has forever altered the way people analyze,
695
     the S system, which has forever altered the way people analyze,
696
     visualize, and manipulate data ...
696
     visualize, and manipulate data ...
697
 
697
 
698
     S is an elegant, widely accepted, and enduring software system, with
698
     S is an elegant, widely accepted, and enduring software system, with
699
     conceptual integrity, thanks to the insight, taste, and effort of John
699
     conceptual integrity, thanks to the insight, taste, and effort of John
700
     Chambers.
700
     Chambers.
701
 
701
 
702
   The evolution of the S language is characterized by four books by John
702
   The evolution of the S language is characterized by four books by John
703
Chambers and coauthors, which are also the primary references for S.
703
Chambers and coauthors, which are also the primary references for S.
704
 
704
 
705
   * Richard A. Becker and John M. Chambers (1984), "S.  An Interactive
705
   * Richard A. Becker and John M. Chambers (1984), "S.  An Interactive
706
     Environment for Data Analysis and Graphics," Monterey: Wadsworth and
706
     Environment for Data Analysis and Graphics," Monterey: Wadsworth and
707
     Brooks/Cole.
707
     Brooks/Cole.
708
 
708
 
709
     This is also referred to as the "_Brown Book_", and of historical
709
     This is also referred to as the "_Brown Book_", and of historical
710
     interest only.
710
     interest only.
711
 
711
 
712
   * Richard A. Becker, John M. Chambers and Allan R. Wilks (1988), "The New
712
   * Richard A. Becker, John M. Chambers and Allan R. Wilks (1988), "The New
713
     S Language," London: Chapman & Hall.
713
     S Language," London: Chapman & Hall.
714
 
714
 
715
     This book is often called the "_Blue Book_", and introduced what is
715
     This book is often called the "_Blue Book_", and introduced what is
716
     now known as S version 2.
716
     now known as S version 2.
717
 
717
 
718
   * John M. Chambers and Trevor J. Hastie (1992), "Statistical Models in
718
   * John M. Chambers and Trevor J. Hastie (1992), "Statistical Models in
719
     S,"  London: Chapman & Hall.
719
     S,"  London: Chapman & Hall.
720
 
720
 
721
     This is also called the "_White Book_", and introduced S version 3,
721
     This is also called the "_White Book_", and introduced S version 3,
722
     which added structures to facilitate statistical modeling in S.
722
     which added structures to facilitate statistical modeling in S.
723
 
723
 
724
   * John M. Chambers (1998), "Programming with Data," New York: Springer,
724
   * John M. Chambers (1998), "Programming with Data," New York: Springer,
725
     ISBN 0-387-98503-4
725
     ISBN 0-387-98503-4
726
     (<http://cm.bell-labs.com/cm/ms/departments/sia/Sbook/>).
726
     (<http://cm.bell-labs.com/cm/ms/departments/sia/Sbook/>).
727
 
727
 
728
     This "_Green Book_" describes version 4 of S, a major revision of S
728
     This "_Green Book_" describes version 4 of S, a major revision of S
729
     designed by John Chambers to improve its usefulness at every stage of
729
     designed by John Chambers to improve its usefulness at every stage of
730
     the programming process.
730
     the programming process.
731
 
731
 
732
   See `http://cm.bell-labs.com/cm/ms/departments/sia/S/history.html' for
732
   See `http://cm.bell-labs.com/cm/ms/departments/sia/S/history.html' for
733
further information on "Stages in the Evolution of S".
733
further information on "Stages in the Evolution of S".
734
 
734
 
735
   There is a huge amount of user-contributed code for S, available at the
735
   There is a huge amount of user-contributed code for S, available at the
736
S Repository (http://lib.stat.cmu.edu/S/) at CMU.
736
S Repository (http://lib.stat.cmu.edu/S/) at CMU.
737
 
737
 
738
3.2 What is S-PLUS?
738
3.2 What is S-PLUS?
739
===================
739
===================
740
 
740
 
741
S-PLUS is a value-added version of S sold by Insightful Corporation.  Based
741
S-PLUS is a value-added version of S sold by Insightful Corporation.  Based
742
on the S language, S-PLUS provides functionality in a wide variety of
742
on the S language, S-PLUS provides functionality in a wide variety of
743
areas, including robust regression, modern non-parametric regression, time
743
areas, including robust regression, modern non-parametric regression, time
744
series, survival analysis, multivariate analysis, classical statistical
744
series, survival analysis, multivariate analysis, classical statistical
745
tests, quality control, and graphics drivers.  Add-on modules add
745
tests, quality control, and graphics drivers.  Add-on modules add
746
additional capabilities for wavelet analysis, spatial statistics, GARCH
746
additional capabilities for wavelet analysis, spatial statistics, GARCH
747
models, and design of experiments.
747
models, and design of experiments.
748
 
748
 
749
   See the Insightful S-PLUS page
749
   See the Insightful S-PLUS page
750
(http://www.insightful.com/products/splus/) for further information.
750
(http://www.insightful.com/products/splus/) for further information.
751
 
751
 
752
3.3 What are the differences between R and S?
752
3.3 What are the differences between R and S?
753
=============================================
753
=============================================
754
 
754
 
755
We can regard S as a language with three current implementations or
755
We can regard S as a language with three current implementations or
756
"engines", the "old S engine" (S version 3; S-PLUS 3.x and 4.x), the "new S
756
"engines", the "old S engine" (S version 3; S-PLUS 3.x and 4.x), the "new S
757
engine" (S version 4; S-PLUS 5.x and above), and R.  Given this
757
engine" (S version 4; S-PLUS 5.x and above), and R.  Given this
758
understanding, asking for "the differences between R and S" really amounts
758
understanding, asking for "the differences between R and S" really amounts
759
to asking for the specifics of the R implementation of the S language,
759
to asking for the specifics of the R implementation of the S language,
760
i.e., the difference between the R and S _engines_.
760
i.e., the difference between the R and S _engines_.
761
 
761
 
762
   For the remainder of this section, "S" refers to the S engines and not
762
   For the remainder of this section, "S" refers to the S engines and not
763
the S language.
763
the S language.
764
 
764
 
765
3.3.1 Lexical scoping
765
3.3.1 Lexical scoping
766
---------------------
766
---------------------
767
 
767
 
768
Contrary to other implementations of the S language, R has adopted the
768
Contrary to other implementations of the S language, R has adopted the
769
evaluation model of Scheme.
769
evaluation model of Scheme.
770
 
770
 
771
   This difference becomes manifest when _free_ variables occur in a
771
   This difference becomes manifest when _free_ variables occur in a
772
function.  Free variables are those which are neither formal parameters
772
function.  Free variables are those which are neither formal parameters
773
(occurring in the argument list of the function) nor local variables
773
(occurring in the argument list of the function) nor local variables
774
(created by assigning to them in the body of the function).  Whereas S
774
(created by assigning to them in the body of the function).  Whereas S
775
(like C) by default uses _static_ scoping, R (like Scheme) has adopted
775
(like C) by default uses _static_ scoping, R (like Scheme) has adopted
776
_lexical_ scoping.  This means the values of free variables are determined
776
_lexical_ scoping.  This means the values of free variables are determined
777
by a set of global variables in S, but in R by the bindings that were in
777
by a set of global variables in S, but in R by the bindings that were in
778
effect at the time the function was created.
778
effect at the time the function was created.
779
 
779
 
780
   Consider the following function:
780
   Consider the following function:
781
 
781
 
782
     cube <- function(n) {
782
     cube <- function(n) {
783
       sq <- function() n * n
783
       sq <- function() n * n
784
       n * sq()
784
       n * sq()
785
     }
785
     }
786
 
786
 
787
   Under S, `sq()' does not "know" about the variable `n' unless it is
787
   Under S, `sq()' does not "know" about the variable `n' unless it is
788
defined globally:
788
defined globally:
789
 
789
 
790
     S> cube(2)
790
     S> cube(2)
791
     Error in sq():  Object "n" not found
791
     Error in sq():  Object "n" not found
792
     Dumped
792
     Dumped
793
     S> n <- 3
793
     S> n <- 3
794
     S> cube(2)
794
     S> cube(2)
795
     [1] 18
795
     [1] 18
796
 
796
 
797
   In R, the "environment" created when `cube()' was invoked is also looked
797
   In R, the "environment" created when `cube()' was invoked is also looked
798
in:
798
in:
799
 
799
 
800
     R> cube(2)
800
     R> cube(2)
801
     [1] 8
801
     [1] 8
802
 
802
 
803
   As a more "interesting" real-world problem, suppose you want to write a
803
   As a more "interesting" real-world problem, suppose you want to write a
804
function which returns the density function of the r-th order statistic
804
function which returns the density function of the r-th order statistic
805
from a sample of size n from a (continuous) distribution.  For simplicity,
805
from a sample of size n from a (continuous) distribution.  For simplicity,
806
we shall use both the cdf and pdf of the distribution as explicit
806
we shall use both the cdf and pdf of the distribution as explicit
807
arguments.  (Example compiled from various postings by Luke Tierney.)
807
arguments.  (Example compiled from various postings by Luke Tierney.)
808
 
808
 
809
   The S-PLUS documentation for `call()' basically suggests the following:
809
   The S-PLUS documentation for `call()' basically suggests the following:
810
 
810
 
811
     dorder <- function(n, r, pfun, dfun) {
811
     dorder <- function(n, r, pfun, dfun) {
812
       f <- function(x) NULL
812
       f <- function(x) NULL
813
       con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
813
       con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
814
       PF <- call(substitute(pfun), as.name("x"))
814
       PF <- call(substitute(pfun), as.name("x"))
815
       DF <- call(substitute(dfun), as.name("x"))
815
       DF <- call(substitute(dfun), as.name("x"))
816
       f[[length(f)]] <-
816
       f[[length(f)]] <-
817
         call("*", con,
817
         call("*", con,
818
              call("*", call("^", PF, r - 1),
818
              call("*", call("^", PF, r - 1),
819
                   call("*", call("^", call("-", 1, PF), n - r),
819
                   call("*", call("^", call("-", 1, PF), n - r),
820
                        DF)))
820
                        DF)))
821
       f
821
       f
822
     }
822
     }
823
 
823
 
824
Rather tricky, isn't it?  The code uses the fact that in S, functions are
824
Rather tricky, isn't it?  The code uses the fact that in S, functions are
825
just lists of special mode with the function body as the last argument, and
825
just lists of special mode with the function body as the last argument, and
826
hence does not work in R (one could make the idea work, though).
826
hence does not work in R (one could make the idea work, though).
827
 
827
 
828
   A version which makes heavy use of `substitute()' and seems to work
828
   A version which makes heavy use of `substitute()' and seems to work
829
under both S and R is
829
under both S and R is
830
 
830
 
831
     dorder <- function(n, r, pfun, dfun) {
831
     dorder <- function(n, r, pfun, dfun) {
832
       con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
832
       con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
833
       eval(substitute(function(x) K * PF(x)^a * (1 - PF(x))^b * DF(x),
833
       eval(substitute(function(x) K * PF(x)^a * (1 - PF(x))^b * DF(x),
834
                       list(PF = substitute(pfun), DF = substitute(dfun),
834
                       list(PF = substitute(pfun), DF = substitute(dfun),
835
                            a = r - 1, b = n - r, K = con)))
835
                            a = r - 1, b = n - r, K = con)))
836
     }
836
     }
837
 
837
 
838
(the `eval()' is not needed in S).
838
(the `eval()' is not needed in S).
839
 
839
 
840
   However, in R there is a much easier solution:
840
   However, in R there is a much easier solution:
841
 
841
 
842
     dorder <- function(n, r, pfun, dfun) {
842
     dorder <- function(n, r, pfun, dfun) {
843
       con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
843
       con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
844
       function(x) {
844
       function(x) {
845
         con * pfun(x)^(r - 1) * (1 - pfun(x))^(n - r) * dfun(x)
845
         con * pfun(x)^(r - 1) * (1 - pfun(x))^(n - r) * dfun(x)
846
       }
846
       }
847
     }
847
     }
848
 
848
 
849
This seems to be the "natural" implementation, and it works because the
849
This seems to be the "natural" implementation, and it works because the
850
free variables in the returned function can be looked up in the defining
850
free variables in the returned function can be looked up in the defining
851
environment (this is lexical scope).
851
environment (this is lexical scope).
852
 
852
 
853
   Note that what you really need is the function _closure_, i.e., the body
853
   Note that what you really need is the function _closure_, i.e., the body
854
along with all variable bindings needed for evaluating it.  Since in the
854
along with all variable bindings needed for evaluating it.  Since in the
855
above version, the free variables in the value function are not modified,
855
above version, the free variables in the value function are not modified,
856
you can actually use it in S as well if you abstract out the closure
856
you can actually use it in S as well if you abstract out the closure
857
operation into a function `MC()' (for "make closure"):
857
operation into a function `MC()' (for "make closure"):
858
 
858
 
859
     dorder <- function(n, r, pfun, dfun) {
859
     dorder <- function(n, r, pfun, dfun) {
860
       con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
860
       con <- round(exp(lgamma(n + 1) - lgamma(r) - lgamma(n - r + 1)))
861
       MC(function(x) {
861
       MC(function(x) {
862
            con * pfun(x)^(r - 1) * (1 - pfun(x))^(n - r) * dfun(x)
862
            con * pfun(x)^(r - 1) * (1 - pfun(x))^(n - r) * dfun(x)
863
          },
863
          },
864
          list(con = con, pfun = pfun, dfun = dfun, r = r, n = n))
864
          list(con = con, pfun = pfun, dfun = dfun, r = r, n = n))
865
     }
865
     }
866
 
866
 
867
   Given the appropriate definitions of the closure operator, this works in
867
   Given the appropriate definitions of the closure operator, this works in
868
both R and S, and is much "cleaner" than a substitute/eval solution (or one
868
both R and S, and is much "cleaner" than a substitute/eval solution (or one
869
which overrules the default scoping rules by using explicit access to
869
which overrules the default scoping rules by using explicit access to
870
evaluation frames, as is of course possible in both R and S).
870
evaluation frames, as is of course possible in both R and S).
871
 
871
 
872
   For R, `MC()' simply is
872
   For R, `MC()' simply is
873
 
873
 
874
     MC <- function(f, env) f
874
     MC <- function(f, env) f
875
 
875
 
876
(lexical scope!), a version for S is
876
(lexical scope!), a version for S is
877
 
877
 
878
     MC <- function(f, env = NULL) {
878
     MC <- function(f, env = NULL) {
879
       env <- as.list(env)
879
       env <- as.list(env)
880
       if (mode(f) != "function")
880
       if (mode(f) != "function")
881
         stop(paste("not a function:", f))
881
         stop(paste("not a function:", f))
882
       if (length(env) > 0 && any(names(env) == ""))
882
       if (length(env) > 0 && any(names(env) == ""))
883
         stop(paste("not all arguments are named:", env))
883
         stop(paste("not all arguments are named:", env))
884
       fargs <- if(length(f) > 1) f[1:(length(f) - 1)] else NULL
884
       fargs <- if(length(f) > 1) f[1:(length(f) - 1)] else NULL
885
       fargs <- c(fargs, env)
885
       fargs <- c(fargs, env)
886
       if (any(duplicated(names(fargs))))
886
       if (any(duplicated(names(fargs))))
887
         stop(paste("duplicated arguments:", paste(names(fargs)),
887
         stop(paste("duplicated arguments:", paste(names(fargs)),
888
              collapse = ", "))
888
              collapse = ", "))
889
       fbody <- f[length(f)]
889
       fbody <- f[length(f)]
890
       cf <- c(fargs, fbody)
890
       cf <- c(fargs, fbody)
891
       mode(cf) <- "function"
891
       mode(cf) <- "function"
892
       return(cf)
892
       return(cf)
893
     }
893
     }
894
 
894
 
895
   Similarly, most optimization (or zero-finding) routines need some
895
   Similarly, most optimization (or zero-finding) routines need some
896
arguments to be optimized over and have other parameters that depend on the
896
arguments to be optimized over and have other parameters that depend on the
897
data but are fixed with respect to optimization.  With R scoping rules,
897
data but are fixed with respect to optimization.  With R scoping rules,
898
this is a trivial problem; simply make up the function with the required
898
this is a trivial problem; simply make up the function with the required
899
definitions in the same environment and scoping takes care of it.  With S,
899
definitions in the same environment and scoping takes care of it.  With S,
900
one solution is to add an extra parameter to the function and to the
900
one solution is to add an extra parameter to the function and to the
901
optimizer to pass in these extras, which however can only work if the
901
optimizer to pass in these extras, which however can only work if the
902
optimizer supports this.
902
optimizer supports this.
903
 
903
 
904
   Lexical scoping allows using function closures and maintaining local
904
   Lexical scoping allows using function closures and maintaining local
905
state.  A simple example (taken from Abelson and Sussman) is obtained by
905
state.  A simple example (taken from Abelson and Sussman) is obtained by
906
typing `demo("scoping")' at the R prompt.  Further information is provided
906
typing `demo("scoping")' at the R prompt.  Further information is provided
907
in the standard R reference "R: A Language for Data Analysis and Graphics"
907
in the standard R reference "R: A Language for Data Analysis and Graphics"
908
(*note What documentation exists for R?::) and in Robert Gentleman and Ross
908
(*note What documentation exists for R?::) and in Robert Gentleman and Ross
909
Ihaka (2000), "Lexical Scope and Statistical Computing", _Journal of
909
Ihaka (2000), "Lexical Scope and Statistical Computing", _Journal of
910
Computational and Graphical Statistics_, *9*, 491-508.
910
Computational and Graphical Statistics_, *9*, 491-508.
911
 
911
 
912
   Lexical scoping also implies a further major difference.  Whereas S
912
   Lexical scoping also implies a further major difference.  Whereas S
913
stores all objects as separate files in a directory somewhere (usually
913
stores all objects as separate files in a directory somewhere (usually
914
`.Data' under the current directory), R does not.  All objects in R are
914
`.Data' under the current directory), R does not.  All objects in R are
915
stored internally.  When R is started up it grabs a piece of memory and
915
stored internally.  When R is started up it grabs a piece of memory and
916
uses it to store the objects.  R performs its own memory management of this
916
uses it to store the objects.  R performs its own memory management of this
917
piece of memory, growing and shrinking its size as needed.  Having
917
piece of memory, growing and shrinking its size as needed.  Having
918
everything in memory is necessary because it is not really possible to
918
everything in memory is necessary because it is not really possible to
919
externally maintain all relevant "environments" of symbol/value pairs.
919
externally maintain all relevant "environments" of symbol/value pairs.
920
This difference also seems to make R _faster_ than S.
920
This difference also seems to make R _faster_ than S.
921
 
921
 
922
   The down side is that if R crashes you will lose all the work for the
922
   The down side is that if R crashes you will lose all the work for the
923
current session.  Saving and restoring the memory "images" (the functions
923
current session.  Saving and restoring the memory "images" (the functions
924
and data stored in R's internal memory at any time) can be a bit slow,
924
and data stored in R's internal memory at any time) can be a bit slow,
925
especially if they are big.  In S this does not happen, because everything
925
especially if they are big.  In S this does not happen, because everything
926
is saved in disk files and if you crash nothing is likely to happen to
926
is saved in disk files and if you crash nothing is likely to happen to
927
them.  (In fact, one might conjecture that the S developers felt that the
927
them.  (In fact, one might conjecture that the S developers felt that the
928
price of changing their approach to persistent storage just to accommodate
928
price of changing their approach to persistent storage just to accommodate
929
lexical scope was far too expensive.)  Hence, when doing important work,
929
lexical scope was far too expensive.)  Hence, when doing important work,
930
you might consider saving often (see *Note How can I save my workspace?::)
930
you might consider saving often (see *Note How can I save my workspace?::)
931
to safeguard against possible crashes.  Other possibilities are logging
931
to safeguard against possible crashes.  Other possibilities are logging
932
your sessions, or have your R commands stored in text files which can be
932
your sessions, or have your R commands stored in text files which can be
933
read in using `source()'.
933
read in using `source()'.
934
 
934
 
935
     *Note:*  If you run R from within Emacs (see *Note R and Emacs::), you
935
     *Note:*  If you run R from within Emacs (see *Note R and Emacs::), you
936
     can save the contents of the interaction buffer to a file and
936
     can save the contents of the interaction buffer to a file and
937
     conveniently manipulate it using `ess-transcript-mode', as well as
937
     conveniently manipulate it using `ess-transcript-mode', as well as
938
     save source copies of all functions and data used.
938
     save source copies of all functions and data used.
939
 
939
 
940
3.3.2 Models
940
3.3.2 Models
941
------------
941
------------
942
 
942
 
943
There are some differences in the modeling code, such as
943
There are some differences in the modeling code, such as
944
 
944
 
945
   * Whereas in S, you would use `lm(y ~ x^3)' to regress `y' on `x^3', in
945
   * Whereas in S, you would use `lm(y ~ x^3)' to regress `y' on `x^3', in
946
     R, you have to insulate powers of numeric vectors (using `I()'), i.e.,
946
     R, you have to insulate powers of numeric vectors (using `I()'), i.e.,
947
     you have to use `lm(y ~ I(x^3))'.
947
     you have to use `lm(y ~ I(x^3))'.
948
 
948
 
949
   * The glm family objects are implemented differently in R and S.  The
949
   * The glm family objects are implemented differently in R and S.  The
950
     same functionality is available but the components have different
950
     same functionality is available but the components have different
951
     names.
951
     names.
952
 
952
 
953
   * Option `na.action' is set to `"na.omit"' by default in R, but not set
953
   * Option `na.action' is set to `"na.omit"' by default in R, but not set
954
     in S.
954
     in S.
955
 
955
 
956
   * Terms objects are stored differently.  In S a terms object is an
956
   * Terms objects are stored differently.  In S a terms object is an
957
     expression with attributes, in R it is a formula with attributes.  The
957
     expression with attributes, in R it is a formula with attributes.  The
958
     attributes have the same names but are mostly stored differently.  The
958
     attributes have the same names but are mostly stored differently.  The
959
     major difference in functionality is that a terms object is
959
     major difference in functionality is that a terms object is
960
     subscriptable in S but not in R.  If you can't imagine why this would
960
     subscriptable in S but not in R.  If you can't imagine why this would
961
     matter then you don't need to know.
961
     matter then you don't need to know.
962
 
962
 
963
   * Finally, in R `y~x+0' is an alternative to `y~x-1' for specifying a
963
   * Finally, in R `y~x+0' is an alternative to `y~x-1' for specifying a
964
     model with no intercept.  Models with no parameters at all can be
964
     model with no intercept.  Models with no parameters at all can be
965
     specified by `y~0'.
965
     specified by `y~0'.
966
 
966
 
967
3.3.3 Others
967
3.3.3 Others
968
------------
968
------------
969
 
969
 
970
Apart from lexical scoping and its implications, R follows the S language
970
Apart from lexical scoping and its implications, R follows the S language
971
definition in the Blue and White Books as much as possible, and hence
971
definition in the Blue and White Books as much as possible, and hence
972
really is an "implementation" of S.  There are some intentional differences
972
really is an "implementation" of S.  There are some intentional differences
973
where the behavior of S is considered "not clean".  In general, the
973
where the behavior of S is considered "not clean".  In general, the
974
rationale is that R should help you detect programming errors, while at the
974
rationale is that R should help you detect programming errors, while at the
975
same time being as compatible as possible with S.
975
same time being as compatible as possible with S.
976
 
976
 
977
   Some known differences are the following.
977
   Some known differences are the following.
978
 
978
 
979
   * In R, if `x' is a list, then `x[i] <- NULL' and `x[[i]] <- NULL'
979
   * In R, if `x' is a list, then `x[i] <- NULL' and `x[[i]] <- NULL'
980
     remove the specified elements from `x'.  The first of these is
980
     remove the specified elements from `x'.  The first of these is
981
     incompatible with S, where it is a no-op.  (Note that you can set
981
     incompatible with S, where it is a no-op.  (Note that you can set
982
     elements to `NULL' using `x[i] <- list(NULL)'.)
982
     elements to `NULL' using `x[i] <- list(NULL)'.)
983
 
983
 
984
   * In S, the functions named `.First' and `.Last' in the `.Data'
984
   * In S, the functions named `.First' and `.Last' in the `.Data'
985
     directory can be used for customizing, as they are executed at the
985
     directory can be used for customizing, as they are executed at the
986
     very beginning and end of a session, respectively.
986
     very beginning and end of a session, respectively.
987
 
987
 
988
     In R, the startup mechanism is as follows.  R first sources the system
988
     In R, the startup mechanism is as follows.  R first sources the system
989
     startup file ``$R_HOME'/library/base/R/Rprofile'.  Then, it searches
989
     startup file ``$R_HOME'/library/base/R/Rprofile'.  Then, it searches
990
     for a site-wide startup profile unless the command line option
990
     for a site-wide startup profile unless the command line option
991
     `--no-site-file' was given.  The name of this file is taken from the
991
     `--no-site-file' was given.  The name of this file is taken from the
992
     value of the `R_PROFILE' environment variable.  If that variable is
992
     value of the `R_PROFILE' environment variable.  If that variable is
993
     unset, the default is ``$R_HOME'/etc/Rprofile.site'
993
     unset, the default is ``$R_HOME'/etc/Rprofile.site'
994
     (``$R_HOME'/etc/Rprofile' in versions prior to 1.4.0).  This code is
994
     (``$R_HOME'/etc/Rprofile' in versions prior to 1.4.0).  This code is
995
     loaded in package *base*.  Then, unless `--no-init-file' was given, R
995
     loaded in package *base*.  Then, unless `--no-init-file' was given, R
996
     searches for a file called `.Rprofile' in the current directory or in
996
     searches for a file called `.Rprofile' in the current directory or in
997
     the user's home directory (in that order) and sources it into the user
997
     the user's home directory (in that order) and sources it into the user
998
     workspace.  It then loads a saved image of the user workspace from
998
     workspace.  It then loads a saved image of the user workspace from
999
     `.RData' in case there is one (unless `--no-restore' was specified).
999
     `.RData' in case there is one (unless `--no-restore' was specified).
1000
     If needed, the functions `.First()' and `.Last()' should be defined in
1000
     If needed, the functions `.First()' and `.Last()' should be defined in
1001
     the appropriate startup profiles.
1001
     the appropriate startup profiles.
1002
 
1002
 
1003
   * In R, `T' and `F' are just variables being set to `TRUE' and `FALSE',
1003
   * In R, `T' and `F' are just variables being set to `TRUE' and `FALSE',
1004
     respectively, but are not reserved words as in S and hence can be
1004
     respectively, but are not reserved words as in S and hence can be
1005
     overwritten by the user.  (This helps e.g. when you have factors with
1005
     overwritten by the user.  (This helps e.g. when you have factors with
1006
     levels `"T"' or `"F"'.)  Hence, when writing code you should always
1006
     levels `"T"' or `"F"'.)  Hence, when writing code you should always
1007
     use `TRUE' and `FALSE'.
1007
     use `TRUE' and `FALSE'.
1008
 
1008
 
1009
   * In R, `dyn.load()' can only load _shared objects_, as created for
1009
   * In R, `dyn.load()' can only load _shared objects_, as created for
1010
     example by `R CMD SHLIB'.
1010
     example by `R CMD SHLIB'.
1011
 
1011
 
1012
   * In R, `attach()' currently only works for lists and data frames, but
1012
   * In R, `attach()' currently only works for lists and data frames, but
1013
     not for directories.  (In fact, `attach()' also works for R data files
1013
     not for directories.  (In fact, `attach()' also works for R data files
1014
     created with `save()', which is analogous to attaching directories in
1014
     created with `save()', which is analogous to attaching directories in
1015
     S.)  Also, you cannot attach at position 1.
1015
     S.)  Also, you cannot attach at position 1.
1016
 
1016
 
1017
   * Categories do not exist in R, and never will as they are deprecated now
1017
   * Categories do not exist in R, and never will as they are deprecated now
1018
     in S.  Use factors instead.
1018
     in S.  Use factors instead.
1019
 
1019
 
1020
   * In R, `For()' loops are not necessary and hence not supported.
1020
   * In R, `For()' loops are not necessary and hence not supported.
1021
 
1021
 
1022
   * In R, `assign()' uses the argument `envir=' rather than `where=' as in
1022
   * In R, `assign()' uses the argument `envir=' rather than `where=' as in
1023
     S.
1023
     S.
1024
 
1024
 
1025
   * The random number generators are different, and the seeds have
1025
   * The random number generators are different, and the seeds have
1026
     different length.
1026
     different length.
1027
 
1027
 
1028
   * R passes integer objects to C as `int *' rather than `long *' as in S.
1028
   * R passes integer objects to C as `int *' rather than `long *' as in S.
1029
 
1029
 
1030
   * R has no single precision storage mode.  However, as of version 0.65.1,
1030
   * R has no single precision storage mode.  However, as of version 0.65.1,
1031
     there is a single precision interface to C/FORTRAN subroutines.
1031
     there is a single precision interface to C/FORTRAN subroutines.
1032
 
1032
 
1033
   * By default, `ls()' returns the names of the objects in the current
1033
   * By default, `ls()' returns the names of the objects in the current
1034
     (under R) and global (under S) environment, respectively.  For example,
1034
     (under R) and global (under S) environment, respectively.  For example,
1035
     given
1035
     given
1036
 
1036
 
1037
          x <- 1; fun <- function() {y <- 1; ls()}
1037
          x <- 1; fun <- function() {y <- 1; ls()}
1038
 
1038
 
1039
     then `fun()' returns `"y"' in R and `"x"' (together with the rest of
1039
     then `fun()' returns `"y"' in R and `"x"' (together with the rest of
1040
     the global environment) in S.
1040
     the global environment) in S.
1041
 
1041
 
1042
   * R allows for zero-extent matrices (and arrays, i.e., some elements of
1042
   * R allows for zero-extent matrices (and arrays, i.e., some elements of
1043
     the `dim' attribute vector can be 0).  This has been determined a
1043
     the `dim' attribute vector can be 0).  This has been determined a
1044
     useful feature as it helps reducing the need for special-case tests for
1044
     useful feature as it helps reducing the need for special-case tests for
1045
     empty subsets.  For example, if `x' is a matrix, `x[, FALSE]' is not
1045
     empty subsets.  For example, if `x' is a matrix, `x[, FALSE]' is not
1046
     `NULL' but a "matrix" with 0 columns.  Hence, such objects need to be
1046
     `NULL' but a "matrix" with 0 columns.  Hence, such objects need to be
1047
     tested for by checking whether their `length()' is zero (which works
1047
     tested for by checking whether their `length()' is zero (which works
1048
     in both R and S), and not using `is.null()'.
1048
     in both R and S), and not using `is.null()'.
1049
 
1049
 
1050
   * Named vectors are considered vectors in R but not in S (e.g.,
1050
   * Named vectors are considered vectors in R but not in S (e.g.,
1051
     `is.vector(c(a = 1:3))' returns `FALSE' in S and `TRUE' in R).
1051
     `is.vector(c(a = 1:3))' returns `FALSE' in S and `TRUE' in R).
1052
 
1052
 
1053
   * Data frames are not considered as matrices in R (i.e., if `DF' is a
1053
   * Data frames are not considered as matrices in R (i.e., if `DF' is a
1054
     data frame, then `is.matrix(DF)' returns `FALSE' in R and `TRUE' in S).
1054
     data frame, then `is.matrix(DF)' returns `FALSE' in R and `TRUE' in S).
1055
 
1055
 
1056
   * R by default uses treatment contrasts in the unordered case, whereas S
1056
   * R by default uses treatment contrasts in the unordered case, whereas S
1057
     uses the Helmert ones.  This is a deliberate difference reflecting the
1057
     uses the Helmert ones.  This is a deliberate difference reflecting the
1058
     opinion that treatment contrasts are more natural.
1058
     opinion that treatment contrasts are more natural.
1059
 
1059
 
1060
   * In R, the argument of a replacement function which corresponds to the
1060
   * In R, the argument of a replacement function which corresponds to the
1061
     right hand side must be named `value'.  E.g., `f(a) <- b' is evaluated
1061
     right hand side must be named `value'.  E.g., `f(a) <- b' is evaluated
1062
     as `a <- "f<-"(a, value = b)'.  S always takes the last argument,
1062
     as `a <- "f<-"(a, value = b)'.  S always takes the last argument,
1063
     irrespective of its name.
1063
     irrespective of its name.
1064
 
1064
 
1065
   * In S, `substitute()' searches for names for substitution in the given
1065
   * In S, `substitute()' searches for names for substitution in the given
1066
     expression in three places: the actual and the default arguments of
1066
     expression in three places: the actual and the default arguments of
1067
     the matching call, and the local frame (in that order).  R looks in
1067
     the matching call, and the local frame (in that order).  R looks in
1068
     the local frame only, with the special rule to use a "promise" if a
1068
     the local frame only, with the special rule to use a "promise" if a
1069
     variable is not evaluated.  Since the local frame is initialized with
1069
     variable is not evaluated.  Since the local frame is initialized with
1070
     the actual arguments or the default expressions, this is usually
1070
     the actual arguments or the default expressions, this is usually
1071
     equivalent to S, until assignment takes place.
1071
     equivalent to S, until assignment takes place.
1072
 
1072
 
1073
   * In S, the index variable in a `for()' loop is local to the inside of
1073
   * In S, the index variable in a `for()' loop is local to the inside of
1074
     the loop.  In R it is local to the environment where the `for()'
1074
     the loop.  In R it is local to the environment where the `for()'
1075
     statement is executed.
1075
     statement is executed.
1076
 
1076
 
1077
   * In S, `tapply(simplify=TRUE)' returns a vector where R returns a
1077
   * In S, `tapply(simplify=TRUE)' returns a vector where R returns a
1078
     one-dimensional array (which can have named dimnames).
1078
     one-dimensional array (which can have named dimnames).
1079
 
1079
 
1080
   * In S(-PLUS) the C locale is used, whereas in R the current operating
1080
   * In S(-PLUS) the C locale is used, whereas in R the current operating
1081
     system locale is used for determining which characters are
1081
     system locale is used for determining which characters are
1082
     alphanumeric and how they are sorted.  This affects the set of valid
1082
     alphanumeric and how they are sorted.  This affects the set of valid
1083
     names for R objects (for example accented chars may be allowed in R)
1083
     names for R objects (for example accented chars may be allowed in R)
1084
     and ordering in sorts and comparisons (such as whether `"aA" < "Bb"' is
1084
     and ordering in sorts and comparisons (such as whether `"aA" < "Bb"' is
1085
     true or false).  From version 1.2.0 the locale can be (re-)set in R by
1085
     true or false).  From version 1.2.0 the locale can be (re-)set in R by
1086
     the `Sys.setlocale()' function.
1086
     the `Sys.setlocale()' function.
1087
 
1087
 
1088
   * In S, `missing(ARG)' remains `TRUE' if ARG is subsequently modified;
1088
   * In S, `missing(ARG)' remains `TRUE' if ARG is subsequently modified;
1089
     in R it doesn't.
1089
     in R it doesn't.
1090
 
1090
 
1091
   * From R version 1.3.0, `data.frame' strips `I()' when creating (column)
1091
   * From R version 1.3.0, `data.frame' strips `I()' when creating (column)
1092
     names.
1092
     names.
1093
 
1093
 
1094
   * In R, the string `"NA"' is not treated as a missing value in a
1094
   * In R, the string `"NA"' is not treated as a missing value in a
1095
     character variable.  Use `as.character(NA)' to create a missing
1095
     character variable.  Use `as.character(NA)' to create a missing
1096
     character value.
1096
     character value.
1097
 
1097
 
1098
   * R disallows repeated formal arguments in function calls.
1098
   * R disallows repeated formal arguments in function calls.
1099
 
1099
 
1100
 
1100
 
1101
   There are also differences which are not intentional, and result from
1101
   There are also differences which are not intentional, and result from
1102
missing or incorrect code in R.  The developers would appreciate hearing
1102
missing or incorrect code in R.  The developers would appreciate hearing
1103
about any deficiencies you may find (in a written report fully documenting
1103
about any deficiencies you may find (in a written report fully documenting
1104
the difference as you see it).  Of course, it would be useful if you were
1104
the difference as you see it).  Of course, it would be useful if you were
1105
to implement the change yourself and make sure it works.
1105
to implement the change yourself and make sure it works.
1106
 
1106
 
1107
3.4 Is there anything R can do that S-PLUS cannot?
1107
3.4 Is there anything R can do that S-PLUS cannot?
1108
==================================================
1108
==================================================
1109
 
1109
 
1110
Since almost anything you can do in R has source code that you could port
1110
Since almost anything you can do in R has source code that you could port
1111
to S-PLUS with little effort there will never be much you can do in R that
1111
to S-PLUS with little effort there will never be much you can do in R that
1112
you couldn't do in S-PLUS if you wanted to.  (Note that using lexical
1112
you couldn't do in S-PLUS if you wanted to.  (Note that using lexical
1113
scoping may simplify matters considerably, though.)
1113
scoping may simplify matters considerably, though.)
1114
 
1114
 
1115
   R offers several graphics features that S-PLUS does not, such as finer
1115
   R offers several graphics features that S-PLUS does not, such as finer
1116
handling of line types, more convenient color handling (via palettes),
1116
handling of line types, more convenient color handling (via palettes),
1117
gamma correction for color, and, most importantly, mathematical annotation
1117
gamma correction for color, and, most importantly, mathematical annotation
1118
in plot texts, via input expressions reminiscent of TeX constructs.  See
1118
in plot texts, via input expressions reminiscent of TeX constructs.  See
1119
the help page for `plotmath', which features an impressive on-line example.
1119
the help page for `plotmath', which features an impressive on-line example.
1120
More details can be found in Paul Murrell and Ross Ihaka (2000), "An
1120
More details can be found in Paul Murrell and Ross Ihaka (2000), "An
1121
Approach to Providing Mathematical Annotation in Plots", _Journal of
1121
Approach to Providing Mathematical Annotation in Plots", _Journal of
1122
Computational and Graphical Statistics_, *9*, 582-599.
1122
Computational and Graphical Statistics_, *9*, 582-599.
1123
 
1123
 
1124
3.5 What is R-plus?
1124
3.5 What is R-plus?
1125
===================
1125
===================
1126
 
1126
 
1127
There is no such thing.
1127
There is no such thing.
1128
 
1128
 
1129
4 R Web Interfaces
1129
4 R Web Interfaces
1130
******************
1130
******************
1131
 
1131
 
1132
*Rweb* is developed and maintained by Jeff Banfield
1132
*Rweb* is developed and maintained by Jeff Banfield
1133
<jeff@math.montana.edu>.  The Rweb Home Page
1133
<jeff@math.montana.edu>.  The Rweb Home Page
1134
(http://www.math.montana.edu/Rweb/) provides access to all three versions
1134
(http://www.math.montana.edu/Rweb/) provides access to all three versions
1135
of Rweb--a simple text entry form that returns output and graphs, a more
1135
of Rweb--a simple text entry form that returns output and graphs, a more
1136
sophisticated Javascript version that provides a multiple window
1136
sophisticated Javascript version that provides a multiple window
1137
environment, and a set of point and click modules that are useful for
1137
environment, and a set of point and click modules that are useful for
1138
introductory statistics courses and require no knowledge of the R language.
1138
introductory statistics courses and require no knowledge of the R language.
1139
All of the Rweb versions can analyze Web accessible datasets if a URL is
1139
All of the Rweb versions can analyze Web accessible datasets if a URL is
1140
provided.
1140
provided.
1141
 
1141
 
1142
   The paper "Rweb: Web-based Statistical Analysis", providing a detailed
1142
   The paper "Rweb: Web-based Statistical Analysis", providing a detailed
1143
explanation of the different versions of Rweb and an overview of how Rweb
1143
explanation of the different versions of Rweb and an overview of how Rweb
1144
works, was published in the Journal of Statistical Software
1144
works, was published in the Journal of Statistical Software
1145
(`http://www.stat.ucla.edu/journals/jss/v04/i01/').
1145
(`http://www.stat.ucla.edu/journals/jss/v04/i01/').
1146
 
1146
 
1147
   Ulf Bartel <ulfi@cs.tu-berlin.de> is working on *R-Online*, a simple
1147
   Ulf Bartel <ulfi@cs.tu-berlin.de> is working on *R-Online*, a simple
1148
on-line programming environment for R which intends to make the first steps
1148
on-line programming environment for R which intends to make the first steps
1149
in statistical programming with R (especially with time series) as easy as
1149
in statistical programming with R (especially with time series) as easy as
1150
possible.  There is no need for a local installation since the only
1150
possible.  There is no need for a local installation since the only
1151
requirement for the user is a JavaScript capable browser.  See
1151
requirement for the user is a JavaScript capable browser.  See
1152
`http://osvisions.com/r-online/' for more information.
1152
`http://osvisions.com/r-online/' for more information.
1153
 
1153
 
1154
   David Firth <http://www.warwick.ac.uk/go/dfirth> has written *CGIwithR*,
1154
   David Firth <http://www.warwick.ac.uk/go/dfirth> has written *CGIwithR*,
1155
an R add-on package available from CRAN.  It provides some simple
1155
an R add-on package available from CRAN.  It provides some simple
1156
extensions to R to facilitate running R scripts through the CGI interface
1156
extensions to R to facilitate running R scripts through the CGI interface
1157
to a web server.  It is easily installed using Apache under Linux and in
1157
to a web server.  It is easily installed using Apache under Linux and in
1158
principle should run on any platform that supports R and a web server
1158
principle should run on any platform that supports R and a web server
1159
provided that the installer has the necessary security permissions.
1159
provided that the installer has the necessary security permissions.
1160
 
1160
 
1161
   *Rcgi* is a CGI WWW interface to R by Mark J. Ray
1161
   *Rcgi* is a CGI WWW interface to R by MJ Ray <mjr@dsl.pipex.com>.  It
1162
<mjr@stats.mth.uea.ac.uk>.  It had the ability to use "embedded code": you
1162
had the ability to use "embedded code": you could mix user input and code,
1163
could mix user input and code, allowing the HTML author to do anything from
1163
allowing the HTML author to do anything from load in data sets to enter
1164
load in data sets to enter most of the commands for users without writing
1164
most of the commands for users without writing CGI scripts.  Graphical
1165
CGI scripts.  Graphical output was possible in PostScript or GIF formats
1165
output was possible in PostScript or GIF formats and the executed code was
1166
and the executed code was presented to the user for revision.  However, it
1166
presented to the user for revision.  However, it is not clear if the
1167
is not clear if the project is still active and recent attempts to contact
-
 
1168
the author or find the package have failed.  Currently, a modified version
1167
project is still active.  Currently, a modified version of *Rcgi* by Mai
1169
of *Rcgi* by Mai Zhou <mai@ms.uky.edu> (actually, two versions: one with
1168
Zhou <mai@ms.uky.edu> (actually, two versions: one with (bitmap) graphics
1170
(bitmap) graphics and one without) as well as the original code are
1169
and one without) as well as the original code are available from
1171
available from `http://www.ms.uky.edu/~statweb'.
1170
`http://www.ms.uky.edu/~statweb'.
1172
 
1171
 
1173
5 R Add-On Packages
1172
5 R Add-On Packages
1174
*******************
1173
*******************
1175
 
1174
 
1176
5.1 Which add-on packages exist for R?
1175
5.1 Which add-on packages exist for R?
1177
======================================
1176
======================================
1178
 
1177
 
1179
5.1.1 Add-on packages in R
1178
5.1.1 Add-on packages in R
1180
--------------------------
1179
--------------------------
1181
 
1180
 
1182
The R distribution comes with the following extra packages:
1181
The R distribution comes with the following extra packages:
1183
 
1182
 
1184
*ctest*
1183
*ctest*
1185
     A collection of Classical TESTs, including the Ansari-Bradley,
1184
     A collection of Classical TESTs, including the Ansari-Bradley,
1186
     Bartlett, chi-squared, Fisher, Kruskal-Wallis, Kolmogorov-Smirnov, t,
1185
     Bartlett, chi-squared, Fisher, Kruskal-Wallis, Kolmogorov-Smirnov, t,
1187
     and Wilcoxon tests.
1186
     and Wilcoxon tests.
1188
 
1187
 
1189
*eda*
1188
*eda*
1190
     Exploratory Data Analysis.  Currently only contains functions for
1189
     Exploratory Data Analysis.  Currently only contains functions for
1191
     robust line fitting, and median polish and smoothing.
1190
     robust line fitting, and median polish and smoothing.
1192
 
1191
 
1193
*grid*
1192
*grid*
1194
     A rewrite of the graphics layout capabilities, plus some support for
1193
     A rewrite of the graphics layout capabilities, plus some support for
1195
     interaction.  (Added in R 1.8.0).
1194
     interaction.  (Added in R 1.8.0).
1196
 
1195
 
1197
*lqs*
1196
*lqs*
1198
     Resistant regression and covariance estimation.
1197
     Resistant regression and covariance estimation.
1199
 
1198
 
1200
*methods*
1199
*methods*
1201
     Formally defined methods and classes for R objects, plus other
1200
     Formally defined methods and classes for R objects, plus other
1202
     programming tools, as described in the Green Book.
1201
     programming tools, as described in the Green Book.
1203
 
1202
 
1204
*mle*
1203
*mle*
1205
     Generic (smooth) likelihood maximization and profiling.  (Added in R
1204
     Generic (smooth) likelihood maximization and profiling.  (Added in R
1206
     1.8.0).
1205
     1.8.0).
1207
 
1206
 
1208
*modreg*
1207
*modreg*
1209
     MODern REGression: smoothing and local methods.
1208
     MODern REGression: smoothing and local methods.
1210
 
1209
 
1211
*mva*
1210
*mva*
1212
     MultiVariate Analysis.  Currently contains code for principal
1211
     MultiVariate Analysis.  Currently contains code for principal
1213
     components, canonical correlations, metric multidimensional scaling,
1212
     components, canonical correlations, metric multidimensional scaling,
1214
     factor analysis, and hierarchical and k-means clustering.
1213
     factor analysis, and hierarchical and k-means clustering.
1215
 
1214
 
1216
*nls*
1215
*nls*
1217
     Nonlinear regression routines.
1216
     Nonlinear regression routines.
1218
 
1217
 
1219
*splines*
1218
*splines*
1220
     Regression spline functions and classes.
1219
     Regression spline functions and classes.
1221
 
1220
 
1222
*stepfun*
1221
*stepfun*
1223
     Code for dealing with STEP FUNctions, including empirical cumulative
1222
     Code for dealing with STEP FUNctions, including empirical cumulative
1224
     distribution functions.
1223
     distribution functions.
1225
 
1224
 
1226
*tcltk*
1225
*tcltk*
1227
     Interface and language bindings to Tcl/Tk GUI elements.
1226
     Interface and language bindings to Tcl/Tk GUI elements.
1228
 
1227
 
1229
*tools*
1228
*tools*
1230
     Tools for package development and administration.
1229
     Tools for package development and administration.
1231
 
1230
 
1232
*ts*
1231
*ts*
1233
     Time Series.
1232
     Time Series.
1234
   In R 1.9, *base* will be split into the four packages *base*,
1233
   In R 1.9, *base* will be split into the four packages *base*,
1235
*graphics*, *stats*, and *utils*.  Packages *ctest*, *eda*, *modreg*, *mva*,
1234
*graphics*, *stats*, and *utils*.  Packages *ctest*, *eda*, *modreg*, *mva*,
1236
*nls*, *stepfun* and *ts* will be merged into *stats*, package *lqs*
1235
*nls*, *stepfun* and *ts* will be merged into *stats*, package *lqs*
1237
returned to the recommended package *MASS*, and package *mle* moved to
1236
returned to the recommended package *MASS*, and package *mle* moved to
1238
*stats4*.
1237
*stats4*.
1239
 
1238
 
1240
5.1.2 Add-on packages from CRAN
1239
5.1.2 Add-on packages from CRAN
1241
-------------------------------
1240
-------------------------------
1242
 
1241
 
1243
The following packages are available from the CRAN `src/contrib' area.
1242
The following packages are available from the CRAN `src/contrib' area.
1244
(Packages denoted as _Recommended_ are to be included in all binary
1243
(Packages denoted as _Recommended_ are to be included in all binary
1245
distributions of R.)
1244
distributions of R.)
1246
 
1245
 
1247
*AlgDesign*
1246
*AlgDesign*
1248
     Algorithmic experimental designs.  Calculates exact and approximate
1247
     Algorithmic experimental designs.  Calculates exact and approximate
1249
     theory experimental designs for D, A, and I criteria.
1248
     theory experimental designs for D, A, and I criteria.
1250
 
1249
 
1251
*AnalyzeFMRI*
1250
*AnalyzeFMRI*
1252
     Functions for I/O, visualisation and analysis of functional Magnetic
1251
     Functions for I/O, visualisation and analysis of functional Magnetic
1253
     Resonance Imaging (fMRI) datasets stored in the ANALYZE format.
1252
     Resonance Imaging (fMRI) datasets stored in the ANALYZE format.
1254
 
1253
 
1255
*Bhat*
1254
*Bhat*
1256
     Functions for general likelihood exploration (MLE, MCMC, CIs).
1255
     Functions for general likelihood exploration (MLE, MCMC, CIs).
1257
 
1256
 
1258
*BradleyTerry*
1257
*BradleyTerry*
1259
     Specify and fit the Bradley-Terry model and structured versions.
1258
     Specify and fit the Bradley-Terry model and structured versions.
1260
 
1259
 
-
 
1260
*BsMD*
-
 
1261
     Bayes screening and model discrimination follow-up designs.
-
 
1262
 
1261
*CDNmoney*
1263
*CDNmoney*
1262
     Components of Canadian monetary aggregates.
1264
     Components of Canadian monetary aggregates.
1263
 
1265
 
1264
*CGIwithR*
1266
*CGIwithR*
1265
     Facilities for the use of R to write CGI scripts.
1267
     Facilities for the use of R to write CGI scripts.
1266
 
1268
 
1267
*CircStats*
1269
*CircStats*
1268
     Circular Statistics, from "Topics in Circular Statistics" by S. Rao
1270
     Circular Statistics, from "Topics in Circular Statistics" by S. Rao
1269
     Jammalamadaka and A. SenGupta, 2001, World Scientific.
1271
     Jammalamadaka and A. SenGupta, 2001, World Scientific.
1270
 
1272
 
1271
*CoCoAn*
1273
*CoCoAn*
1272
     Constrained Correspondence Analysis.
1274
     Constrained Correspondence Analysis.
1273
 
1275
 
1274
*DAAG*
1276
*DAAG*
1275
     Various data sets used in examples and exercises in "Data Analysis and
1277
     Various data sets used in examples and exercises in "Data Analysis and
1276
     Graphics Using R" by John H. Maindonald and W. John Brown, 2003.
1278
     Graphics Using R" by John H. Maindonald and W. John Brown, 2003.
1277
 
1279
 
1278
*DBI*
1280
*DBI*
1279
     A common database interface (DBI) class and method definitions.  All
1281
     A common database interface (DBI) class and method definitions.  All
1280
     classes in this package are virtual and need to be extended by the
1282
     classes in this package are virtual and need to be extended by the
1281
     various DBMS implementations.
1283
     various DBMS implementations.
1282
 
1284
 
1283
*Davies*
1285
*Davies*
1284
     Functions for the Davies quantile function and the Generalized Lambda
1286
     Functions for the Davies quantile function and the Generalized Lambda
1285
     distribution.
1287
     distribution.
1286
 
1288
 
1287
*Design*
1289
*Design*
1288
     Regression modeling, testing, estimation, validation, graphics,
1290
     Regression modeling, testing, estimation, validation, graphics,
1289
     prediction, and typesetting by storing enhanced model design attributes
1291
     prediction, and typesetting by storing enhanced model design attributes
1290
     in the fit.  Design is a collection of about 180 functions that assist
1292
     in the fit.  Design is a collection of about 180 functions that assist
1291
     and streamline modeling, especially for biostatistical and
1293
     and streamline modeling, especially for biostatistical and
1292
     epidemiologic applications.  It also contains new functions for binary
1294
     epidemiologic applications.  It also contains new functions for binary
1293
     and ordinal logistic regression models and the Buckley-James multiple
1295
     and ordinal logistic regression models and the Buckley-James multiple
1294
     regression model for right-censored responses, and implements
1296
     regression model for right-censored responses, and implements
1295
     penalized maximum likelihood estimation for logistic and ordinary
1297
     penalized maximum likelihood estimation for logistic and ordinary
1296
     linear models.  Design works with almost any regression model, but it
1298
     linear models.  Design works with almost any regression model, but it
1297
     was especially written to work with logistic regression, Cox
1299
     was especially written to work with logistic regression, Cox
1298
     regression, accelerated failure time models, ordinary linear models,
1300
     regression, accelerated failure time models, ordinary linear models,
1299
     and the Buckley-James model.
1301
     and the Buckley-James model.
1300
 
1302
 
1301
*Devore5*
1303
*Devore5*
1302
     Data sets and sample analyses from "Probability and Statistics for
1304
     Data sets and sample analyses from "Probability and Statistics for
1303
     Engineering and the Sciences (5th ed)" by Jay L. Devore, 2000, Duxbury.
1305
     Engineering and the Sciences (5th ed)" by Jay L. Devore, 2000, Duxbury.
1304
 
1306
 
1305
*Devore6*
1307
*Devore6*
1306
     Data sets and sample analyses from "Probability and Statistics for
1308
     Data sets and sample analyses from "Probability and Statistics for
1307
     Engineering and the Sciences (6th ed)" by Jay L. Devore, 2003, Duxbury.
1309
     Engineering and the Sciences (6th ed)" by Jay L. Devore, 2003, Duxbury.
1308
 
1310
 
1309
*EMV*
1311
*EMV*
1310
     Estimation of missing values in a matrix by a k-th nearest neighboors
1312
     Estimation of missing values in a matrix by a k-th nearest neighboors
1311
     algorithm.
1313
     algorithm.
1312
 
1314
 
1313
*GRASS*
1315
*GRASS*
1314
     An interface between the GRASS geographical information system and R,
1316
     An interface between the GRASS geographical information system and R,
1315
     based on starting R from within the GRASS environment and chosen
1317
     based on starting R from within the GRASS environment and chosen
1316
     LOCATION_NAME and MAPSET.  Wrapper and helper functions are provided
1318
     LOCATION_NAME and MAPSET.  Wrapper and helper functions are provided
1317
     for a range of R functions to match the interface metadata structures.
1319
     for a range of R functions to match the interface metadata structures.
1318
 
1320
 
1319
*GenKern*
1321
*GenKern*
1320
     Functions for generating and manipulating generalised binned kernel
1322
     Functions for generating and manipulating generalised binned kernel
1321
     density estimates.
1323
     density estimates.
1322
 
1324
 
1323
*GeneTS*
1325
*GeneTS*
1324
     A package for analysing multiple gene expression time series data.
1326
     A package for analysing multiple gene expression time series data.
1325
     Currently, implements methods for cell cycle analysis and for inferring
1327
     Currently, implements methods for cell cycle analysis and for inferring
1326
     large sparse graphical Gaussian models.
1328
     large sparse graphical Gaussian models.
1327
 
1329
 
1328
*HI*
1330
*HI*
1329
     Simulation from distributions supported by nested hyperplanes.
1331
     Simulation from distributions supported by nested hyperplanes.
1330
 
1332
 
1331
*Hmisc*
1333
*Hmisc*
1332
     Functions useful for data analysis, high-level graphics, utility
1334
     Functions useful for data analysis, high-level graphics, utility
1333
     operations, functions for computing sample size and power, importing
1335
     operations, functions for computing sample size and power, importing
1334
     datasets, imputing missing values, advanced table making, variable
1336
     datasets, imputing missing values, advanced table making, variable
1335
     clustering, character string manipulation, conversion of S objects to
1337
     clustering, character string manipulation, conversion of S objects to
1336
     LaTeX code, recoding variables, and bootstrap repeated measures
1338
     LaTeX code, recoding variables, and bootstrap repeated measures
1337
     analysis.
1339
     analysis.
1338
 
1340
 
1339
*HyperbolicDist*
1341
*HyperbolicDist*
1340
     Basic functions for the hyperbolic distribution: probability density
1342
     Basic functions for the hyperbolic distribution: probability density
1341
     function, distribution function, quantile function, a routine for
1343
     function, distribution function, quantile function, a routine for
1342
     generating observations from the hyperbolic, and a function for fitting
1344
     generating observations from the hyperbolic, and a function for fitting
1343
     the hyperbolic distribution to data.
1345
     the hyperbolic distribution to data.
1344
 
1346
 
1345
*ISwR*
1347
*ISwR*
1346
     Data sets for "Introductory Statistics with R" by Peter Dalgaard,
1348
     Data sets for "Introductory Statistics with R" by Peter Dalgaard,
1347
     2002, Springer.
1349
     2002, Springer.
1348
 
1350
 
1349
*KMsurv*
1351
*KMsurv*
1350
     Data sets and functions for "Survival Analysis, Techniques for Censored
1352
     Data sets and functions for "Survival Analysis, Techniques for Censored
1351
     and Truncated Data" by Klein and Moeschberger, 1997, Springer.
1353
     and Truncated Data" by Klein and Moeschberger, 1997, Springer.
1352
 
1354
 
1353
*KernSmooth*
1355
*KernSmooth*
1354
     Functions for kernel smoothing (and density estimation) corresponding
1356
     Functions for kernel smoothing (and density estimation) corresponding
1355
     to the book "Kernel Smoothing" by M. P. Wand and M. C. Jones, 1995.
1357
     to the book "Kernel Smoothing" by M. P. Wand and M. C. Jones, 1995.
1356
     _Recommended_.
1358
     _Recommended_.
1357
 
1359
 
1358
*MASS*
1360
*MASS*
1359
     Functions and datasets from the main package of Venables and Ripley,
1361
     Functions and datasets from the main package of Venables and Ripley,
1360
     "Modern Applied Statistics with S".  Contained in the `VR' bundle.
1362
     "Modern Applied Statistics with S".  Contained in the `VR' bundle.
1361
     _Recommended_.
1363
     _Recommended_.
1362
 
1364
 
1363
*MCMCpack*
1365
*MCMCpack*
1364
     Markov chain Monte Carlo (MCMC) package: functions for posterior
1366
     Markov chain Monte Carlo (MCMC) package: functions for posterior
1365
     simulation for a number of statistical models.
1367
     simulation for a number of statistical models.
1366
 
1368
 
1367
*MPV*
1369
*MPV*
1368
     Data sets from the book "Introduction to Linear Regression Analysis"
1370
     Data sets from the book "Introduction to Linear Regression Analysis"
1369
     by D. C. Montgomery, E. A. Peck, and C. G. Vining, 2001, John Wiley and
1371
     by D. C. Montgomery, E. A. Peck, and C. G. Vining, 2001, John Wiley and
1370
     Sons.
1372
     Sons.
1371
 
1373
 
1372
*Matrix*
1374
*Matrix*
1373
     A Matrix package.
1375
     A Matrix package.
1374
 
1376
 
1375
*NISTnls*
1377
*NISTnls*
1376
     A set of test nonlinear least squares examples from NIST, the U.S.
1378
     A set of test nonlinear least squares examples from NIST, the U.S.
1377
     National Institute for Standards and Technology.
1379
     National Institute for Standards and Technology.
1378
 
1380
 
1379
*Oarray*
1381
*Oarray*
1380
     Arrays with arbitrary offsets.
1382
     Arrays with arbitrary offsets.
1381
 
1383
 
1382
*PHYLOGR*
1384
*PHYLOGR*
1383
     Manipulation and analysis of phylogenetically simulated data sets (as
1385
     Manipulation and analysis of phylogenetically simulated data sets (as
1384
     obtained from PDSIMUL in package PDAP) and phylogenetically-based
1386
     obtained from PDSIMUL in package PDAP) and phylogenetically-based
1385
     analyses using GLS.
1387
     analyses using GLS.
1386
 
1388
 
1387
*PTAk*
1389
*PTAk*
1388
     A multiway method to decompose a tensor (array) of any order, as a
1390
     A multiway method to decompose a tensor (array) of any order, as a
1389
     generalisation of SVD also supporting non-identity metrics and
1391
     generalisation of SVD also supporting non-identity metrics and
1390
     penalisations.  Also includes some other multiway methods.
1392
     penalisations.  Also includes some other multiway methods.
1391
 
1393
 
1392
*R2HTML*
1394
*R2HTML*
1393
     Functions for exporting R objects & graphics in an HTML document.
1395
     Functions for exporting R objects & graphics in an HTML document.
1394
 
1396
 
1395
*R2WinBUGS*
1397
*R2WinBUGS*
1396
     Running WinBUGS from R: call a BUGS model, summarize inferences and
1398
     Running WinBUGS from R: call a BUGS model, summarize inferences and
1397
     convergence in a table and graph, and save the simulations in arrays
1399
     convergence in a table and graph, and save the simulations in arrays
1398
     for easy access in R.
1400
     for easy access in R.
1399
 
1401
 
1400
*RArcInfo*
1402
*RArcInfo*
1401
     Functions to import Arc/Info V7.x coverages and data.
1403
     Functions to import Arc/Info V7.x coverages and data.
1402
 
1404
 
1403
*RColorBrewer*
1405
*RColorBrewer*
1404
     ColorBrewer palettes for drawing nice maps shaded according to a
1406
     ColorBrewer palettes for drawing nice maps shaded according to a
1405
     variable.
1407
     variable.
1406
 
1408
 
1407
*RMySQL*
1409
*RMySQL*
1408
     An interface between R and the MySQL database system.
1410
     An interface between R and the MySQL database system.
1409
 
1411
 
1410
*RODBC*
1412
*RODBC*
1411
     An ODBC database interface.
1413
     An ODBC database interface.
1412
 
1414
 
1413
*ROracle*
1415
*ROracle*
1414
     Oracle Database Interface driver for R.  Uses the ProC/C++ embedded
1416
     Oracle Database Interface driver for R.  Uses the ProC/C++ embedded
1415
     SQL.
1417
     SQL.
1416
 
1418
 
1417
*RQuantLib*
1419
*RQuantLib*
1418
     Provides access to (some) of the QuantLib functions from within R;
1420
     Provides access to (some) of the QuantLib functions from within R;
1419
     currently limited to some Option pricing and analysis functions.  The
1421
     currently limited to some Option pricing and analysis functions.  The
1420
     QuantLib project aims to provide a comprehensive software framework for
1422
     QuantLib project aims to provide a comprehensive software framework for
1421
     quantitative finance.
1423
     quantitative finance.
1422
 
1424
 
1423
*RSQLite*
1425
*RSQLite*
1424
     Database Interface R driver for SQLite.  Embeds the SQLite database
1426
     Database Interface R driver for SQLite.  Embeds the SQLite database
1425
     engine in R.
1427
     engine in R.
1426
 
1428
 
1427
*RSvgDevice*
1429
*RSvgDevice*
1428
     A graphics device for R that uses the new w3.org XML standard for
1430
     A graphics device for R that uses the new w3.org XML standard for
1429
     Scalable Vector Graphics.
1431
     Scalable Vector Graphics.
1430
 
1432
 
1431
*RadioSonde*
1433
*RadioSonde*
1432
     A collection of programs for reading and plotting SKEW-T,log p diagrams
1434
     A collection of programs for reading and plotting SKEW-T,log p diagrams
1433
     and wind profiles for data collected by radiosondes (the typical
1435
     and wind profiles for data collected by radiosondes (the typical
1434
     weather balloon-borne instrument).
1436
     weather balloon-borne instrument).
1435
 
1437
 
1436
*RandomFields*
1438
*RandomFields*
1437
     Creating random fields using various methods.
1439
     Creating random fields using various methods.
1438
 
1440
 
1439
*Rcmdr*
1441
*Rcmdr*
1440
     A platform-independent basic-statistics GUI (graphical user interface)
1442
     A platform-independent basic-statistics GUI (graphical user interface)
1441
     for R, based on the *tcltk* package.
1443
     for R, based on the *tcltk* package.
1442
 
1444
 
1443
*RmSQL*
1445
*RmSQL*
1444
     An interface between R and the mSQL database system.
1446
     An interface between R and the mSQL database system.
1445
 
1447
 
1446
*Rwave*
1448
*Rwave*
1447
     An environment for the time-frequency analysis of 1-D signals (and
1449
     An environment for the time-frequency analysis of 1-D signals (and
1448
     especially for the wavelet and Gabor transforms of noisy signals),
1450
     especially for the wavelet and Gabor transforms of noisy signals),
1449
     based on the book "Practical Time-Frequency Analysis: Gabor and Wavelet
1451
     based on the book "Practical Time-Frequency Analysis: Gabor and Wavelet
1450
     Transforms with an Implementation in S" by Rene Carmona, Wen L. Hwang
1452
     Transforms with an Implementation in S" by Rene Carmona, Wen L. Hwang
1451
     and Bruno Torresani, 1998, Academic Press.
1453
     and Bruno Torresani, 1998, Academic Press.
1452
 
1454
 
1453
*SASmixed*
1455
*SASmixed*
1454
     Data sets and sample linear mixed effects analyses corresponding to the
1456
     Data sets and sample linear mixed effects analyses corresponding to the
1455
     examples in "SAS System for Mixed Models" by R. C. Littell, G. A.
1457
     examples in "SAS System for Mixed Models" by R. C. Littell, G. A.
1456
     Milliken, W. W. Stroup and R. D. Wolfinger, 1996, SAS Institute.
1458
     Milliken, W. W. Stroup and R. D. Wolfinger, 1996, SAS Institute.
1457
 
1459
 
1458
*SenSrivastava*
1460
*SenSrivastava*
1459
     Collection of datasets from "Regression Analysis, Theory, Methods and
1461
     Collection of datasets from "Regression Analysis, Theory, Methods and
1460
     Applications" by A. Sen and M. Srivastava, 1990, Springer-Verlag.
1462
     Applications" by A. Sen and M. Srivastava, 1990, Springer-Verlag.
1461
 
1463
 
1462
*SoPhy*
1464
*SoPhy*
1463
     Soil Physics Tools: simulation of water flux and solute transport in
1465
     Soil Physics Tools: simulation of water flux and solute transport in
1464
     soil.
1466
     soil.
1465
 
1467
 
1466
*SparseM*
1468
*SparseM*
1467
     Basic linear algebra for sparse matrices.
1469
     Basic linear algebra for sparse matrices.
1468
 
1470
 
1469
*StatDataML*
1471
*StatDataML*
1470
     Read and write StatDataML.
1472
     Read and write StatDataML.
1471
 
1473
 
1472
*SuppDists*
1474
*SuppDists*
1473
     Ten distributions supplementing those built into R (Inverse Gauss,
1475
     Ten distributions supplementing those built into R (Inverse Gauss,
1474
     Kruskal-Wallis, Kendall's Tau, Friedman's chi squared, Spearman's rho,
1476
     Kruskal-Wallis, Kendall's Tau, Friedman's chi squared, Spearman's rho,
1475
     maximum F ratio, the Pearson product moment correlation coefficiant,
1477
     maximum F ratio, the Pearson product moment correlation coefficiant,
1476
     Johnson distributions, normal scores and generalized hypergeometric
1478
     Johnson distributions, normal scores and generalized hypergeometric
1477
     distributions).
1479
     distributions).
1478
 
1480
 
1479
*VLMC*
1481
*VLMC*
1480
     Functions, classes & methods for estimation, prediction, and simulation
1482
     Functions, classes & methods for estimation, prediction, and simulation
1481
     (bootstrap) of VLMC (Variable Length Markov Chain) models.
1483
     (bootstrap) of VLMC (Variable Length Markov Chain) models.
1482
 
1484
 
1483
*VaR*
1485
*VaR*
1484
     Methods for calculation of Value at Risk (VaR).
1486
     Methods for calculation of Value at Risk (VaR).
1485
 
1487
 
1486
*XML*
1488
*XML*
1487
     Facilities for reading XML documents and DTDs.
1489
     Facilities for reading XML documents and DTDs.
1488
 
1490
 
1489
*abind*
1491
*abind*
1490
     Combine multi-dimensional arrays.
1492
     Combine multi-dimensional arrays.
1491
 
1493
 
1492
*acepack*
1494
*acepack*
1493
     ACE (Alternating Conditional Expectations) and AVAS (Additivity and
1495
     ACE (Alternating Conditional Expectations) and AVAS (Additivity and
1494
     VAriance Stabilization for regression) methods for selecting regression
1496
     VAriance Stabilization for regression) methods for selecting regression
1495
     transformations.
1497
     transformations.
1496
 
1498
 
1497
*adapt*
1499
*adapt*
1498
     Adaptive quadrature in up to 20 dimensions.
1500
     Adaptive quadrature in up to 20 dimensions.
1499
 
1501
 
1500
*ade4*
1502
*ade4*
1501
     Multivariate data analysis and graphical display.
1503
     Multivariate data analysis and graphical display.
1502
 
1504
 
1503
*agce*
1505
*agce*
1504
     Analysis of growth curve experiments.
1506
     Analysis of growth curve experiments.
1505
 
1507
 
1506
*akima*
1508
*akima*
1507
     Linear or cubic spline interpolation for irregularly gridded data.
1509
     Linear or cubic spline interpolation for irregularly gridded data.
1508
 
1510
 
1509
*amap*
1511
*amap*
1510
     Another Multidimensional Analysis Package.
1512
     Another Multidimensional Analysis Package.
1511
 
1513
 
1512
*anm*
1514
*anm*
1513
     Analog model for statistical/empirical downscaling.
1515
     Analog model for statistical/empirical downscaling.
1514
 
1516
 
1515
*ape*
1517
*ape*
1516
     Analyses of Phylogenetics and Evolution, providing functions for
1518
     Analyses of Phylogenetics and Evolution, providing functions for
1517
     reading and plotting phylogenetic trees in parenthetic format
1519
     reading and plotting phylogenetic trees in parenthetic format
1518
     (standard Newick format), analyses of comparative data in a
1520
     (standard Newick format), analyses of comparative data in a
1519
     phylogenetic framework, analyses of diversification and
1521
     phylogenetic framework, analyses of diversification and
1520
     macroevolution, computing distances from allelic and nucleotide data,
1522
     macroevolution, computing distances from allelic and nucleotide data,
1521
     reading nucleotide sequences from GenBank via internet, and several
1523
     reading nucleotide sequences from GenBank via internet, and several
1522
     tools such as Mantel's test, computation of minimum spanning tree, or
1524
     tools such as Mantel's test, computation of minimum spanning tree, or
1523
     the population parameter theta based on various approaches.
1525
     the population parameter theta based on various approaches.
1524
 
1526
 
1525
*ash*
1527
*ash*
1526
     David Scott's ASH routines for 1D and 2D density estimation.
1528
     David Scott's ASH routines for 1D and 2D density estimation.
1527
 
1529
 
1528
*assist*
1530
*assist*
1529
     A suite of functions implementing smoothing splines.
1531
     A suite of functions implementing smoothing splines.
1530
 
1532
 
1531
*asypow*
1533
*asypow*
1532
     A set of routines that calculate power and related quantities utilizing
1534
     A set of routines that calculate power and related quantities utilizing
1533
     asymptotic likelihood ratio methods.
1535
     asymptotic likelihood ratio methods.
1534
 
1536
 
1535
*aws*
1537
*aws*
1536
     Functions to perform adaptive weights smoothing.
1538
     Functions to perform adaptive weights smoothing.
1537
 
1539
 
1538
*bim*
1540
*bim*
1539
     Bayesian interval mapping diagnostics:  functions to interpret QTLCart
1541
     Bayesian interval mapping diagnostics:  functions to interpret QTLCart
1540
     and Bmapqtl samples.
1542
     and Bmapqtl samples.
1541
 
1543
 
1542
*bindata*
1544
*bindata*
1543
     Generation of correlated artificial binary data.
1545
     Generation of correlated artificial binary data.
1544
 
1546
 
1545
*blighty*
1547
*blighty*
1546
     Function for drawing the coastline of the United Kingdom.
1548
     Function for drawing the coastline of the United Kingdom.
1547
 
1549
 
1548
*boolean*
1550
*boolean*
1549
     Boolean logit and probit: a procedure for testing Boolean hypotheses.
1551
     Boolean logit and probit: a procedure for testing Boolean hypotheses.
1550
 
1552
 
1551
*boot*
1553
*boot*
1552
     Functions and datasets for bootstrapping from the book "Bootstrap
1554
     Functions and datasets for bootstrapping from the book "Bootstrap
1553
     Methods and Their Applications" by A. C. Davison and D. V. Hinkley,
1555
     Methods and Their Applications" by A. C. Davison and D. V. Hinkley,
1554
     1997, Cambridge University Press.  _Recommended_.
1556
     1997, Cambridge University Press.  _Recommended_.
1555
 
1557
 
1556
*bootstrap*
1558
*bootstrap*
1557
     Software (bootstrap, cross-validation, jackknife), data and errata for
1559
     Software (bootstrap, cross-validation, jackknife), data and errata for
1558
     the book "An Introduction to the Bootstrap" by B. Efron and R.
1560
     the book "An Introduction to the Bootstrap" by B. Efron and R.
1559
     Tibshirani, 1993, Chapman and Hall.
1561
     Tibshirani, 1993, Chapman and Hall.
1560
 
1562
 
1561
*bqtl*
1563
*bqtl*
1562
     QTL mapping toolkit for inbred crosses and recombinant inbred lines.
1564
     QTL mapping toolkit for inbred crosses and recombinant inbred lines.
1563
     Includes maximum likelihood and Bayesian tools.
1565
     Includes maximum likelihood and Bayesian tools.
1564
 
1566
 
1565
*brlr*
1567
*brlr*
1566
     Bias-reduced logistic regression: fits logistic regression models by
1568
     Bias-reduced logistic regression: fits logistic regression models by
1567
     maximum penalized likelihood.
1569
     maximum penalized likelihood.
1568
 
1570
 
1569
*car*
1571
*car*
1570
     Companion to Applied Regression, containing functions for applied
1572
     Companion to Applied Regression, containing functions for applied
1571
     regession, linear models, and generalized linear models, with an
1573
     regession, linear models, and generalized linear models, with an
1572
     emphasis on regression diagnostics, particularly graphical diagnostic
1574
     emphasis on regression diagnostics, particularly graphical diagnostic
1573
     methods.
1575
     methods.
1574
 
1576
 
1575
*cat*
1577
*cat*
1576
     Analysis of categorical-variable datasets with missing values.
1578
     Analysis of categorical-variable datasets with missing values.
1577
 
1579
 
1578
*cclust*
1580
*cclust*
1579
     Convex clustering methods, including k-means algorithm, on-line update
1581
     Convex clustering methods, including k-means algorithm, on-line update
1580
     algorithm (Hard Competitive Learning) and Neural Gas algorithm (Soft
1582
     algorithm (Hard Competitive Learning) and Neural Gas algorithm (Soft
1581
     Competitive Learning) and calculation of several indexes for finding
1583
     Competitive Learning) and calculation of several indexes for finding
1582
     the number of clusters in a data set.
1584
     the number of clusters in a data set.
1583
 
1585
 
1584
*cfa*
1586
*cfa*
1585
     Analysis of configuration frequencies.
1587
     Analysis of configuration frequencies.
1586
 
1588
 
1587
*chron*
1589
*chron*
1588
     A package for working with chronological objects (times and dates).
1590
     A package for working with chronological objects (times and dates).
1589
 
1591
 
1590
*class*
1592
*class*
1591
     Functions for classification (k-nearest neighbor and LVQ).  Contained
1593
     Functions for classification (k-nearest neighbor and LVQ).  Contained
1592
     in the `VR' bundle.  _Recommended_.
1594
     in the `VR' bundle.  _Recommended_.
1593
 
1595
 
1594
*classPP*
1596
*classPP*
1595
     Projection Pursuit for supervised classification.
1597
     Projection Pursuit for supervised classification.
1596
 
1598
 
1597
*clim.pact*
1599
*clim.pact*
1598
     Climate analysis and downscaling for monthly and daily data.
1600
     Climate analysis and downscaling for monthly and daily data.
1599
 
1601
 
1600
*clines*
1602
*clines*
1601
     Calculates Contour Lines.
1603
     Calculates Contour Lines.
1602
 
1604
 
1603
*cluster*
1605
*cluster*
1604
     Functions for cluster analysis.  _Recommended_.
1606
     Functions for cluster analysis.  _Recommended_.
1605
 
1607
 
1606
*cmprsk*
1608
*cmprsk*
1607
     Estimation, testing and regression modeling of subdistribution
1609
     Estimation, testing and regression modeling of subdistribution
1608
     functions in competing risks.
1610
     functions in competing risks.
1609
 
1611
 
1610
*cobs*
1612
*cobs*
1611
     Constrained B-splines: qualitatively constrained (regression) smoothing
1613
     Constrained B-splines: qualitatively constrained (regression) smoothing
1612
     via linear programming.
1614
     via linear programming.
1613
 
1615
 
1614
*coda*
1616
*coda*
1615
     Output analysis and diagnostics for Markov Chain Monte Carlo (MCMC)
1617
     Output analysis and diagnostics for Markov Chain Monte Carlo (MCMC)
1616
     simulations.
1618
     simulations.
1617
 
1619
 
1618
*combinat*
1620
*combinat*
1619
     Combinatorics utilities.
1621
     Combinatorics utilities.
1620
 
1622
 
1621
*concord*
1623
*concord*
1622
     Measures of concordance and reliability.
1624
     Measures of concordance and reliability.
1623
 
1625
 
1624
*conf.design*
1626
*conf.design*
1625
     A series of simple tools for constructing and manipulating confounded
1627
     A series of simple tools for constructing and manipulating confounded
1626
     and fractional factorial designs.
1628
     and fractional factorial designs.
1627
 
1629
 
1628
*covRobust*
1630
*covRobust*
1629
     Robust covariance estimation via nearest neighbor cleaning.
1631
     Robust covariance estimation via nearest neighbor cleaning.
1630
 
1632
 
1631
*cramer*
1633
*cramer*
1632
     Routine for the multivariate nonparametric Cramer test.
1634
     Routine for the multivariate nonparametric Cramer test.
1633
 
1635
 
1634
*date*
1636
*date*
1635
     Functions for dealing with dates.  The most useful of them accepts a
1637
     Functions for dealing with dates.  The most useful of them accepts a
1636
     vector of input dates in any of the forms `8/30/53', `30Aug53', `30
1638
     vector of input dates in any of the forms `8/30/53', `30Aug53', `30
1637
     August 1953', ..., `August 30 53', or any mixture of these.
1639
     August 1953', ..., `August 30 53', or any mixture of these.
1638
 
1640
 
1639
*dblcens*
1641
*dblcens*
1640
     Calculates the NPMLE of the survival distribution for doubly censored
1642
     Calculates the NPMLE of the survival distribution for doubly censored
1641
     data.
1643
     data.
1642
 
1644
 
1643
*deal*
1645
*deal*
1644
     Bayesian networks with continuous and/or discrete variables can be
1646
     Bayesian networks with continuous and/or discrete variables can be
1645
     learned and compared from data.
1647
     learned and compared from data.
1646
 
1648
 
1647
*debug*
1649
*debug*
1648
     Debugger for R functions, with code display, graceful error recovery,
1650
     Debugger for R functions, with code display, graceful error recovery,
1649
     line-numbered conditional breakpoints, access to exit code, flow
1651
     line-numbered conditional breakpoints, access to exit code, flow
1650
     control, and full keyboard input.
1652
     control, and full keyboard input.
1651
 
1653
 
1652
*deldir*
1654
*deldir*
1653
     Calculates the  Delaunay triangulation and the Dirichlet or Voronoi
1655
     Calculates the  Delaunay triangulation and the Dirichlet or Voronoi
1654
     tesselation (with respect to the entire plane) of a planar point set.
1656
     tesselation (with respect to the entire plane) of a planar point set.
1655
 
1657
 
1656
*diamonds*
1658
*diamonds*
1657
     Functions for illustrating aperture-4 diamond partitions in the plane,
1659
     Functions for illustrating aperture-4 diamond partitions in the plane,
1658
     or on the surface of an octahedron or icosahedron, for use as analysis
1660
     or on the surface of an octahedron or icosahedron, for use as analysis
1659
     or sampling grids.
1661
     or sampling grids.
1660
 
1662
 
1661
*dichromat*
1663
*dichromat*
1662
     Color schemes for dichromats: collapse red-green distinctions to
1664
     Color schemes for dichromats: collapse red-green distinctions to
1663
     simulate the effects of colour-blindness.
1665
     simulate the effects of colour-blindness.
1664
 
1666
 
1665
*digest*
1667
*digest*
1666
     Two functions for the creation of "hash" digests of arbitrary R
1668
     Two functions for the creation of "hash" digests of arbitrary R
1667
     objects using the md5 and sha-1 algorithms permitting easy comparison
1669
     objects using the md5 and sha-1 algorithms permitting easy comparison
1668
     of R language objects.
1670
     of R language objects.
1669
 
1671
 
1670
*diptest*
1672
*diptest*
1671
     Compute Hartigan's dip test statistic for unimodality.
1673
     Compute Hartigan's dip test statistic for unimodality.
1672
 
1674
 
1673
*dispmod*
1675
*dispmod*
1674
     Functions for modelling dispersion in GLMs.
1676
     Functions for modelling dispersion in GLMs.
1675
 
1677
 
1676
*dr*
1678
*dr*
1677
     Functions, methods, and datasets for fitting dimension reduction
1679
     Functions, methods, and datasets for fitting dimension reduction
1678
     regression, including pHd and inverse regression methods SIR and SAVE.
1680
     regression, including pHd and inverse regression methods SIR and SAVE.
1679
 
1681
 
1680
*dse*
1682
*dse*
1681
     Dynamic System Estimation, a multivariate time series package.
1683
     Dynamic System Estimation, a multivariate time series package.
1682
     Contains *dse1* (the base system, including multivariate ARMA and state
1684
     Contains *dse1* (the base system, including multivariate ARMA and state
1683
     space models), *dse2* (extensions for evaluating estimation
1685
     space models), *dse2* (extensions for evaluating estimation
1684
     techniques, forecasting, and for evaluating forecasting model),
1686
     techniques, forecasting, and for evaluating forecasting model),
1685
     *tframe* (functions for writing code that is independent of the
1687
     *tframe* (functions for writing code that is independent of the
1686
     representation of time). and *setRNG* (a mechanism for generating the
1688
     representation of time). and *setRNG* (a mechanism for generating the
1687
     same random numbers in S and R).
1689
     same random numbers in S and R).
1688
 
1690
 
1689
*dynamicGraph*
1691
*dynamicGraph*
1690
     Interactive graphical tool for manipulating graphs.
1692
     Interactive graphical tool for manipulating graphs.
1691
 
1693
 
1692
*e1071*
1694
*e1071*
1693
     Miscellaneous functions used at the Department of Statistics at TU Wien
1695
     Miscellaneous functions used at the Department of Statistics at TU Wien
1694
     (E1071), including moments, short-time Fourier transforms, Independent
1696
     (E1071), including moments, short-time Fourier transforms, Independent
1695
     Component Analysis, Latent Class Analysis, support vector machines, and
1697
     Component Analysis, Latent Class Analysis, support vector machines, and
1696
     fuzzy clustering, shortest path computation, bagged clustering, and
1698
     fuzzy clustering, shortest path computation, bagged clustering, and
1697
     some more.
1699
     some more.
1698
 
1700
 
1699
*effects*
1701
*effects*
1700
     Graphical and tabular effect displays, e.g., of interactions, for
1702
     Graphical and tabular effect displays, e.g., of interactions, for
1701
     linear and generalised linear models.
1703
     linear and generalised linear models.
1702
 
1704
 
1703
*eha*
1705
*eha*
1704
     A package for survival and event history analysis.
1706
     A package for survival and event history analysis.
1705
 
1707
 
1706
*ellipse*
1708
*ellipse*
1707
     Package for drawing ellipses and ellipse-like confidence regions.
1709
     Package for drawing ellipses and ellipse-like confidence regions.
1708
 
1710
 
1709
*emme2*
1711
*emme2*
1710
     Functions to read from and write to an EMME/2 databank.
1712
     Functions to read from and write to an EMME/2 databank.
1711
 
1713
 
1712
*emplik*
1714
*emplik*
1713
     Empirical likelihood ratio for means/quantiles/hazards from possibly
1715
     Empirical likelihood ratio for means/quantiles/hazards from possibly
1714
     right censored data.
1716
     right censored data.
1715
 
1717
 
1716
*evd*
1718
*evd*
1717
     Functions for extreme value distributions.  Extends simulation,
1719
     Functions for extreme value distributions.  Extends simulation,
1718
     distribution, quantile and density functions to univariate, bivariate
1720
     distribution, quantile and density functions to univariate, bivariate
1719
     and (for simulation) multivariate parametric extreme value
1721
     and (for simulation) multivariate parametric extreme value
1720
     distributions, and provides fitting functions which calculate maximum
1722
     distributions, and provides fitting functions which calculate maximum
1721
     likelihood estimates for univariate and bivariate models.
1723
     likelihood estimates for univariate and bivariate models.
1722
 
1724
 
1723
*exactLoglinTest*
1725
*exactLoglinTest*
1724
     Monte Carlo exact tests for log-linear models.
1726
     Monte Carlo exact tests for log-linear models.
1725
 
1727
 
1726
*exactRankTests*
1728
*exactRankTests*
1727
     Computes exact p-values and quantiles using an implementation of the
1729
     Computes exact p-values and quantiles using an implementation of the
1728
     Streitberg/Roehmel shift algorithm.
1730
     Streitberg/Roehmel shift algorithm.
1729
 
1731
 
1730
*fastICA*
1732
*fastICA*
1731
     Implementation of FastICA algorithm to perform Independent Component
1733
     Implementation of FastICA algorithm to perform Independent Component
1732
     Analysis (ICA) and Projection Pursuit.
1734
     Analysis (ICA) and Projection Pursuit.
1733
 
1735
 
1734
*fda*
1736
*fda*
1735
     Functional Data Analysis: analysis of data where the basic observation
1737
     Functional Data Analysis: analysis of data where the basic observation
1736
     is a function of some sort.
1738
     is a function of some sort.
1737
 
1739
 
1738
*fdim*
1740
*fdim*
1739
     Functions for calculating fractal dimension.
1741
     Functions for calculating fractal dimension.
1740
 
1742
 
1741
*fields*
1743
*fields*
1742
     A collection of programs for curve and function fitting with an
1744
     A collection of programs for curve and function fitting with an
1743
     emphasis on spatial data.  The major methods implemented include cubic
1745
     emphasis on spatial data.  The major methods implemented include cubic
1744
     and thin plate splines, universal Kriging and Kriging for large data
1746
     and thin plate splines, universal Kriging and Kriging for large data
1745
     sets.  The main feature is that any covariance function implemented in
1747
     sets.  The main feature is that any covariance function implemented in
1746
     R can be used for spatial prediction.
1748
     R can be used for spatial prediction.
1747
 
1749
 
1748
*flexmix*
1750
*flexmix*
1749
     Flexible Mixture Modeling: a general framework for finite mixtures of
1751
     Flexible Mixture Modeling: a general framework for finite mixtures of
1750
     regression models using the EM algorithm.
1752
     regression models using the EM algorithm.
1751
 
1753
 
1752
*foreign*
1754
*foreign*
1753
     Functions for reading and writing data stored by statistical software
1755
     Functions for reading and writing data stored by statistical software
1754
     like Minitab, SAS, SPSS, Stata, etc.  _Recommended_.
1756
     like Minitab, SAS, SPSS, Stata, etc.  _Recommended_.
1755
 
1757
 
1756
*fork*
1758
*fork*
1757
     Functions for handling multiple processes: simple wrappers around the
1759
     Functions for handling multiple processes: simple wrappers around the
1758
     Unix process management API calls.
1760
     Unix process management API calls.
1759
 
1761
 
1760
*forward*
1762
*forward*
1761
     Forward search approach to robust analysis in linear and generalized
1763
     Forward search approach to robust analysis in linear and generalized
1762
     linear regression models.
1764
     linear regression models.
1763
 
1765
 
1764
*fpc*
1766
*fpc*
1765
     Fixed point clusters, clusterwise regression and discriminant plots.
1767
     Fixed point clusters, clusterwise regression and discriminant plots.
1766
 
1768
 
1767
*fracdiff*
1769
*fracdiff*
1768
     Maximum likelihood estimation of the parameters of a fractionally
1770
     Maximum likelihood estimation of the parameters of a fractionally
1769
     differenced ARIMA(p,d,q) model (Haslett and Raftery, Applied
1771
     differenced ARIMA(p,d,q) model (Haslett and Raftery, Applied
1770
     Statistics, 1989).
1772
     Statistics, 1989).
1771
 
1773
 
1772
*ftnonpar*
1774
*ftnonpar*
1773
     Features and strings for nonparametric regression.
1775
     Features and strings for nonparametric regression.
1774
 
1776
 
1775
*g.data*
1777
*g.data*
1776
     Create and maintain delayed-data packages (DDP's).
1778
     Create and maintain delayed-data packages (DDP's).
1777
 
1779
 
1778
*gafit*
1780
*gafit*
1779
     Genetic algorithm for curve fitting.
1781
     Genetic algorithm for curve fitting.
1780
 
1782
 
1781
*gap*
1783
*gap*
1782
     Genetic analysis package for both population and family data.
1784
     Genetic analysis package for both population and family data.
1783
 
1785
 
1784
*gbm*
1786
*gbm*
1785
     Generalized Boosted Regression Models: implements extensions to Freund
1787
     Generalized Boosted Regression Models: implements extensions to Freund
1786
     and Schapire's AdaBoost algorithm and J. Friedman's gradient boosting
1788
     and Schapire's AdaBoost algorithm and J. Friedman's gradient boosting
1787
     machine.  Includes regression methods for least squares, absolute loss,
1789
     machine.  Includes regression methods for least squares, absolute loss,
1788
     logistic, Poisson, Cox proportional hazards partial likelihood, and
1790
     logistic, Poisson, Cox proportional hazards partial likelihood, and
1789
     AdaBoost exponential loss.
1791
     AdaBoost exponential loss.
1790
 
1792
 
1791
*gclus*
1793
*gclus*
1792
     Clustering Graphics.  Orders panels in scatterplot matrices and
1794
     Clustering Graphics.  Orders panels in scatterplot matrices and
1793
     parallel coordinate displays by some merit index.
1795
     parallel coordinate displays by some merit index.
1794
 
1796
 
1795
*gee*
1797
*gee*
1796
     An implementation of the Liang/Zeger generalized estimating equation
1798
     An implementation of the Liang/Zeger generalized estimating equation
1797
     approach to GLMs for dependent data.
1799
     approach to GLMs for dependent data.
1798
 
1800
 
1799
*geepack*
1801
*geepack*
1800
     Generalized estimating equations solver for parameters in mean, scale,
1802
     Generalized estimating equations solver for parameters in mean, scale,
1801
     and correlation structures, through mean link, scale link, and
1803
     and correlation structures, through mean link, scale link, and
1802
     correlation link.  Can also handle clustered categorical responses.
1804
     correlation link.  Can also handle clustered categorical responses.
1803
 
1805
 
1804
*genetics*
1806
*genetics*
1805
     Classes and methods for handling genetic data.  Includes classes to
1807
     Classes and methods for handling genetic data.  Includes classes to
1806
     represent genotypes and haplotypes at single markers up to multiple
1808
     represent genotypes and haplotypes at single markers up to multiple
1807
     markers on multiple chromosomes, and functions for allele frequencies,
1809
     markers on multiple chromosomes, and functions for allele frequencies,
1808
     flagging homo/heterozygotes, flagging carriers of certain alleles,
1810
     flagging homo/heterozygotes, flagging carriers of certain alleles,
1809
     computing disequlibrium, testing Hardy-Weinberg equilibrium, ...
1811
     computing disequlibrium, testing Hardy-Weinberg equilibrium, ...
1810
 
1812
 
1811
*geoR*
1813
*geoR*
1812
     Functions to perform geostatistical data analysis including model-based
1814
     Functions to perform geostatistical data analysis including model-based
1813
     methods.
1815
     methods.
1814
 
1816
 
1815
*geoRglm*
1817
*geoRglm*
1816
     Functions for inference in generalised linear spatial models.
1818
     Functions for inference in generalised linear spatial models.
1817
 
1819
 
1818
*ggm*
1820
*ggm*
1819
     Functions for defining directed acyclic graphs and undirected graphs,
1821
     Functions for defining directed acyclic graphs and undirected graphs,
1820
     finding induced graphs and fitting Gaussian Markov models.
1822
     finding induced graphs and fitting Gaussian Markov models.
1821
 
1823
 
1822
*gld*
1824
*gld*
1823
     Basic functions for the generalised (Tukey) lambda distribution.
1825
     Basic functions for the generalised (Tukey) lambda distribution.
1824
 
1826
 
1825
*gllm*
1827
*gllm*
1826
     Routines for log-linear models of incomplete contingency tables,
1828
     Routines for log-linear models of incomplete contingency tables,
1827
     including some latent class models via EM and Fisher scoring
1829
     including some latent class models via EM and Fisher scoring
1828
     approaches.
1830
     approaches.
1829
 
1831
 
1830
*glmmML*
1832
*glmmML*
1831
     A Maximum Likelihood approach to generalized linear models with random
1833
     A Maximum Likelihood approach to generalized linear models with random
1832
     intercept.
1834
     intercept.
1833
 
1835
 
1834
*gpclib*
1836
*gpclib*
1835
     General polygon clipping routines for R based on Alan Murta's C
1837
     General polygon clipping routines for R based on Alan Murta's C
1836
     library.
1838
     library.
1837
 
1839
 
1838
*grasper*
1840
*grasper*
1839
     Generalized Regression Analysis and Spatial Predictions for R.
1841
     Generalized Regression Analysis and Spatial Predictions for R.
1840
 
1842
 
1841
*gregmisc*
1843
*gregmisc*
1842
     Miscellaneous functions written/maintained by Gregory R. Warnes.
1844
     Miscellaneous functions written/maintained by Gregory R. Warnes.
1843
 
1845
 
1844
*gridBase*
1846
*gridBase*
1845
     Integration of base and grid graphics.
1847
     Integration of base and grid graphics.
1846
 
1848
 
1847
*gss*
1849
*gss*
1848
     A comprehensive package for structural multivariate function estimation
1850
     A comprehensive package for structural multivariate function estimation
1849
     using smoothing splines.
1851
     using smoothing splines.
1850
 
1852
 
1851
*gstat*
1853
*gstat*
1852
     multivariable geostatistical modelling, prediction and simulation.
1854
     multivariable geostatistical modelling, prediction and simulation.
1853
     Includes code for variogram modelling; simple, ordinary and universal
1855
     Includes code for variogram modelling; simple, ordinary and universal
1854
     point or block (co)kriging, sequential Gaussian or indicator
1856
     point or block (co)kriging, sequential Gaussian or indicator
1855
     (co)simulation, and map plotting functions.
1857
     (co)simulation, and map plotting functions.
1856
 
1858
 
1857
*gtkDevice*
1859
*gtkDevice*
1858
     GTK graphics device driver that may be used independently of the
1860
     GTK graphics device driver that may be used independently of the
1859
     R-GNOME interface and can be used to create R devices as embedded
1861
     R-GNOME interface and can be used to create R devices as embedded
1860
     components in a GUI using a Gtk drawing area widget, e.g., using RGtk.
1862
     components in a GUI using a Gtk drawing area widget, e.g., using RGtk.
1861
 
1863
 
1862
*hapassoc*
1864
*hapassoc*
1863
     Likelihood inference of trait associations with SNP haplotypes and
1865
     Likelihood inference of trait associations with SNP haplotypes and
1864
     other attributes using the EM Algorithm.
1866
     other attributes using the EM Algorithm.
1865
 
1867
 
1866
*haplo.score*
1868
*haplo.score*
1867
     Score tests for association of traits with haplotypes when linkage
1869
     Score tests for association of traits with haplotypes when linkage
1868
     phase is ambiguous.
1870
     phase is ambiguous.
1869
 
1871
 
1870
*hdf5*
1872
*hdf5*
1871
     Interface to the NCSA HDF5 library.
1873
     Interface to the NCSA HDF5 library.
1872
 
1874
 
-
 
1875
*hett*
-
 
1876
     Functions for the fitting and summarizing of heteroscedastic
-
 
1877
     t-regression.
-
 
1878
 
1873
*hier.part*
1879
*hier.part*
1874
     Hierarchical Partitioning: variance partition of a multivariate data
1880
     Hierarchical Partitioning: variance partition of a multivariate data
1875
     set.
1881
     set.
1876
 
1882
 
1877
*homals*
1883
*homals*
1878
     Homogeneity Analysis (HOMALS) package with optional Tcl/Tk interface.
1884
     Homogeneity Analysis (HOMALS) package with optional Tcl/Tk interface.
1879
 
1885
 
1880
*hwde*
1886
*hwde*
1881
     Models and tests for departure from Hardy-Weinberg equilibrium and
1887
     Models and tests for departure from Hardy-Weinberg equilibrium and
1882
     independence between loci.
1888
     independence between loci.
1883
 
1889
 
1884
*ifs*
1890
*ifs*
1885
     Iterated Function Systems distribution function estimator.
1891
     Iterated Function Systems distribution function estimator.
1886
 
1892
 
1887
*impute*
1893
*impute*
1888
     Imputation for microarray data (currently KNN only).
1894
     Imputation for microarray data (currently KNN only).
1889
 
1895
 
1890
*ineq*
1896
*ineq*
1891
     Inequality, concentration and poverty measures, and Lorenz curves
1897
     Inequality, concentration and poverty measures, and Lorenz curves
1892
     (empirical and theoretic).
1898
     (empirical and theoretic).
1893
 
1899
 
1894
*ipred*
1900
*ipred*
1895
     Improved predictive models by direct and indirect bootstrap aggregation
1901
     Improved predictive models by direct and indirect bootstrap aggregation
1896
     in classification and regression as well as resampling based estimators
1902
     in classification and regression as well as resampling based estimators
1897
     of prediction error.
1903
     of prediction error.
1898
 
1904
 
1899
*ismev*
1905
*ismev*
1900
     Functions to support the computations carried out in "An Introduction
1906
     Functions to support the computations carried out in "An Introduction
1901
     to Statistical Modeling of Extreme Values;' by S. Coles, 2001,
1907
     to Statistical Modeling of Extreme Values;' by S. Coles, 2001,
1902
     Springer.  The functions may be divided into the following groups;
1908
     Springer.  The functions may be divided into the following groups;
1903
     maxima/minima, order statistics, peaks over thresholds and point
1909
     maxima/minima, order statistics, peaks over thresholds and point
1904
     processes.
1910
     processes.
1905
 
1911
 
1906
*its*
1912
*its*
1907
     An S4 class for handling irregular time series.
1913
     An S4 class for handling irregular time series.
1908
 
1914
 
-
 
1915
*kernlab*
-
 
1916
     Kernel-based machine learning methods including support vector
-
 
1917
     machines.  (Currently in `1.9.0/Other'.)
-
 
1918
 
1909
*knnTree*
1919
*knnTree*
1910
     Construct or predict with k-nearest-neighbor classifiers, using
1920
     Construct or predict with k-nearest-neighbor classifiers, using
1911
     cross-validation to select k, choose variables (by forward or
1921
     cross-validation to select k, choose variables (by forward or
1912
     backwards selection), and choose scaling (from among no scaling,
1922
     backwards selection), and choose scaling (from among no scaling,
1913
     scaling each column by its SD, or scaling each column by its MAD).
1923
     scaling each column by its SD, or scaling each column by its MAD).
1914
     The finished classifier will consist of a classification tree with one
1924
     The finished classifier will consist of a classification tree with one
1915
     such k-nn classifier in each leaf.
1925
     such k-nn classifier in each leaf.
1916
 
1926
 
1917
*labstatR*
1927
*labstatR*
1918
     Functions for the book "Laboratorio di statistica con R" by S. M.
1928
     Functions for the book "Laboratorio di statistica con R" by S. M.
1919
     Iacus and G. Masarotto, 2002, McGraw-Hill.  Function names and
1929
     Iacus and G. Masarotto, 2002, McGraw-Hill.  Function names and
1920
     documentation in Italian.
1930
     documentation in Italian.
1921
 
1931
 
1922
*lars*
1932
*lars*
1923
     Least Angle Regression, Lasso and Forward Stagewise: efficient
1933
     Least Angle Regression, Lasso and Forward Stagewise: efficient
1924
     procedures for fitting an entire lasso sequence with the cost of a
1934
     procedures for fitting an entire lasso sequence with the cost of a
1925
     single least squares fit.
1935
     single least squares fit.
1926
 
1936
 
1927
*lasso2*
1937
*lasso2*
1928
     Routines and documentation for solving regression problems while
1938
     Routines and documentation for solving regression problems while
1929
     imposing an L1 constraint on the estimates, based on the algorithm of
1939
     imposing an L1 constraint on the estimates, based on the algorithm of
1930
     Osborne et al. (1998)
1940
     Osborne et al. (1998)
1931
 
1941
 
1932
*lattice*
1942
*lattice*
1933
     Lattice graphics, an implementation of Trellis Graphics functions.
1943
     Lattice graphics, an implementation of Trellis Graphics functions.
1934
     _Recommended_.
1944
     _Recommended_.
1935
 
1945
 
1936
*lazy*
1946
*lazy*
1937
     Lazy learning for local regression.
1947
     Lazy learning for local regression.
1938
 
1948
 
1939
*ldDesign*
1949
*ldDesign*
1940
     Design of experiments for detection of linkage disequilibrium,
1950
     Design of experiments for detection of linkage disequilibrium,
1941
 
1951
 
1942
*leaps*
1952
*leaps*
1943
     A package which performs an exhaustive search for the best subsets of a
1953
     A package which performs an exhaustive search for the best subsets of a
1944
     given set of potential regressors, using a branch-and-bound algorithm,
1954
     given set of potential regressors, using a branch-and-bound algorithm,
1945
     and also performs searches using a number of less time-consuming
1955
     and also performs searches using a number of less time-consuming
1946
     techniques.
1956
     techniques.
1947
 
1957
 
1948
*lgtdl*
1958
*lgtdl*
1949
     A set of methods for longitudinal data objects.
1959
     A set of methods for longitudinal data objects.
1950
 
1960
 
1951
*linprog*
1961
*linprog*
1952
     Solve linear programming/linear optimization problems by using the
1962
     Solve linear programming/linear optimization problems by using the
1953
     simplex algorithm.
1963
     simplex algorithm.
1954
 
1964
 
1955
*lme4*
1965
*lme4*
1956
     Fit linear and generalized linear mixed-effects models.
1966
     Fit linear and generalized linear mixed-effects models.
1957
 
1967
 
1958
*lmeSplines*
1968
*lmeSplines*
1959
     Fit smoothing spline terms in Gaussian linear and nonlinear
1969
     Fit smoothing spline terms in Gaussian linear and nonlinear
1960
     mixed-effects models.
1970
     mixed-effects models.
1961
 
1971
 
1962
*lmm*
1972
*lmm*
1963
     Linear mixed models.
1973
     Linear mixed models.
1964
 
1974
 
1965
*lmtest*
1975
*lmtest*
1966
     A collection of tests on the assumptions of linear regression models
1976
     A collection of tests on the assumptions of linear regression models
1967
     from the book "The linear regression model under test" by W. Kraemer
1977
     from the book "The linear regression model under test" by W. Kraemer
1968
     and H. Sonnberger, 1986, Physica.
1978
     and H. Sonnberger, 1986, Physica.
1969
 
1979
 
1970
*locfit*
1980
*locfit*
1971
     Local Regression, likelihood and density estimation.
1981
     Local Regression, likelihood and density estimation.
1972
 
1982
 
1973
*logistf*
1983
*logistf*
1974
     Firth's bias reduced logistic regression approach with penalized
1984
     Firth's bias reduced logistic regression approach with penalized
1975
     profile likelihood based confidence intervals for parameter estimates.
1985
     profile likelihood based confidence intervals for parameter estimates.
1976
 
1986
 
1977
*logspline*
1987
*logspline*
1978
     Logspline density estimation.
1988
     Logspline density estimation.
1979
 
1989
 
1980
*lokern*
1990
*lokern*
1981
     Kernel regression smoothing with adaptive local or global plug-in
1991
     Kernel regression smoothing with adaptive local or global plug-in
1982
     bandwidth selection.
1992
     bandwidth selection.
1983
 
1993
 
1984
*lpSolve*
1994
*lpSolve*
1985
     Functions that solve general linear/integer problems, assignment
1995
     Functions that solve general linear/integer problems, assignment
1986
     problems, and transportation problems via interfacing Lp_solve.
1996
     problems, and transportation problems via interfacing Lp_solve.
1987
 
1997
 
1988
*lpridge*
1998
*lpridge*
1989
     Local polynomial (ridge) regression.
1999
     Local polynomial (ridge) regression.
1990
 
2000
 
1991
*magic*
2001
*magic*
1992
     A variety of methods for creating magic squares of any order greater
2002
     A variety of methods for creating magic squares of any order greater
1993
     than 2, and various magic hypercubes.
2003
     than 2, and various magic hypercubes.
1994
 
2004
 
1995
*mapdata*
2005
*mapdata*
1996
     Supplement to package *maps*, providing the larger and/or
2006
     Supplement to package *maps*, providing the larger and/or
1997
     higher-resolution databases.
2007
     higher-resolution databases.
1998
 
2008
 
1999
*mapproj*
2009
*mapproj*
2000
     Map Projections: converts latitude/longitude into projected
2010
     Map Projections: converts latitude/longitude into projected
2001
     coordinates.
2011
     coordinates.
2002
 
2012
 
2003
*maps*
2013
*maps*
2004
     Draw geographical maps.  Projection code and larger maps are in
2014
     Draw geographical maps.  Projection code and larger maps are in
2005
     separate packages.
2015
     separate packages.
2006
 
2016
 
2007
*maptools*
2017
*maptools*
2008
     Set of tools for manipulating and reading geographic data, in
2018
     Set of tools for manipulating and reading geographic data, in
2009
     particular ESRI shapefiles.
2019
     particular ESRI shapefiles.
2010
 
2020
 
2011
*maptree*
2021
*maptree*
2012
     Functions with example data for graphing and mapping models from
2022
     Functions with example data for graphing and mapping models from
2013
     hierarchical clustering and classification and regression trees.
2023
     hierarchical clustering and classification and regression trees.
2014
 
2024
 
2015
*maxstat*
2025
*maxstat*
2016
     Maximally selected rank and Gauss statistics with several p-value
2026
     Maximally selected rank and Gauss statistics with several p-value
2017
     approximations.
2027
     approximations.
2018
 
2028
 
2019
*mclust*
2029
*mclust*
2020
     Model-based cluster analysis: the 2002 version of MCLUST.
2030
     Model-based cluster analysis: the 2002 version of MCLUST.
2021
 
2031
 
2022
*mclust1998*
-
 
2023
     Model-based cluster analysis: the 1998 version of MCLUST.
-
 
2024
 
-
 
2025
*mda*
2032
*mda*
2026
     Code for mixture discriminant analysis (MDA), flexible discriminant
2033
     Code for mixture discriminant analysis (MDA), flexible discriminant
2027
     analysis (FDA), penalized discriminant analysis (PDA), multivariate
2034
     analysis (FDA), penalized discriminant analysis (PDA), multivariate
2028
     additive regression splines (MARS), adaptive back-fitting splines
2035
     additive regression splines (MARS), adaptive back-fitting splines
2029
     (BRUTO), and penalized regression.
2036
     (BRUTO), and penalized regression.
2030
 
2037
 
2031
*meanscore*
2038
*meanscore*
2032
     Mean Score method for missing covariate data in logistic regression
2039
     Mean Score method for missing covariate data in logistic regression
2033
     models.
2040
     models.
2034
 
2041
 
2035
*merror*
2042
*merror*
2036
     Accuracy and precision of measurements.
2043
     Accuracy and precision of measurements.
2037
 
2044
 
2038
*mgcv*
2045
*mgcv*
2039
     Routines for GAMs and other genralized ridge regression problems with
2046
     Routines for GAMs and other genralized ridge regression problems with
2040
     multiple smoothing parameter selection by GCV or UBRE.  _Recommended_.
2047
     multiple smoothing parameter selection by GCV or UBRE.  _Recommended_.
2041
 
2048
 
2042
*mimR*
2049
*mimR*
2043
     An R interface to MIM for graphical modeling in R.
2050
     An R interface to MIM for graphical modeling in R.
2044
 
2051
 
2045
*mix*
2052
*mix*
2046
     Estimation/multiple imputation programs for mixed categorical and
2053
     Estimation/multiple imputation programs for mixed categorical and
2047
     continuous data.
2054
     continuous data.
2048
 
2055
 
2049
*mlbench*
2056
*mlbench*
2050
     A collection of artificial and real-world machine learning benchmark
2057
     A collection of artificial and real-world machine learning benchmark
2051
     problems, including the Boston housing data.
2058
     problems, including the Boston housing data.
2052
 
2059
 
2053
*mmlcr*
2060
*mmlcr*
2054
     Mixed-mode latent class regression (also known as mixed-mode mixture
2061
     Mixed-mode latent class regression (also known as mixed-mode mixture
2055
     model regression or mixed-mode mixture regression models) which can
2062
     model regression or mixed-mode mixture regression models) which can
2056
     handle both longitudinal and one-time responses.
2063
     handle both longitudinal and one-time responses.
2057
 
2064
 
2058
*moc*
2065
*moc*
2059
     Fits a variety of mixtures models for multivariate observations with
2066
     Fits a variety of mixtures models for multivariate observations with
2060
     user-difined distributions and curves.
2067
     user-difined distributions and curves.
2061
 
2068
 
2062
*mscalib*
2069
*mscalib*
2063
     Calibration and filtering of MALDI-TOF Peptide Mass Fingerprint data.
2070
     Calibration and filtering of MALDI-TOF Peptide Mass Fingerprint data.
2064
 
2071
 
2065
*msm*
2072
*msm*
2066
     Functions for fitting continuous-time Markov multi-state models to
2073
     Functions for fitting continuous-time Markov multi-state models to
2067
     categorical processes observed at arbitrary times, optionally with
2074
     categorical processes observed at arbitrary times, optionally with
2068
     misclassified responses, and covariates on transition or
2075
     misclassified responses, and covariates on transition or
2069
     misclassification rates.
2076
     misclassification rates.
2070
 
2077
 
2071
*muhaz*
2078
*muhaz*
2072
     Hazard function estimation in survival analysis.
2079
     Hazard function estimation in survival analysis.
2073
 
2080
 
2074
*multcomp*
2081
*multcomp*
2075
     Multiple comparison procedures for the one-way layout.
2082
     Multiple comparison procedures for the one-way layout.
2076
 
2083
 
2077
*multidim*
2084
*multidim*
2078
     Multidimensional descriptive statistics: factorial methods and
2085
     Multidimensional descriptive statistics: factorial methods and
2079
     classification.
2086
     classification.
2080
 
2087
 
-
 
2088
*multinomRob*
-
 
2089
     Overdispersed multinomial regression using robust (LQD and tanh)
-
 
2090
     estimation.
-
 
2091
 
2081
*multiv*
2092
*multiv*
2082
     Functions for hierarchical clustering, partitioning, bond energy
2093
     Functions for hierarchical clustering, partitioning, bond energy
2083
     algorithm, Sammon mapping, PCA and correspondence analysis.
2094
     algorithm, Sammon mapping, PCA and correspondence analysis.
2084
 
2095
 
2085
*mvbutils*
2096
*mvbutils*
2086
     Utilities by Mark V. Bravington for project organization, editing and
2097
     Utilities by Mark V. Bravington for project organization, editing and
2087
     backup, sourcing, documentation (formal and informal), package
2098
     backup, sourcing, documentation (formal and informal), package
2088
     preparation, macro functions, and more.
2099
     preparation, macro functions, and more.
2089
 
2100
 
2090
*mvnmle*
2101
*mvnmle*
2091
     ML estimation for multivariate normal data with missing values.
2102
     ML estimation for multivariate normal data with missing values.
2092
 
2103
 
2093
*mvnormtest*
2104
*mvnormtest*
2094
     Generalization of the Shapiro-Wilk test for multivariate variables.
2105
     Generalization of the Shapiro-Wilk test for multivariate variables.
2095
 
2106
 
2096
*mvpart*
2107
*mvpart*
2097
     Multivariate partitioning.
2108
     Multivariate partitioning.
2098
 
2109
 
2099
*mvtnorm*
2110
*mvtnorm*
2100
     Multivariate normal and t distributions.
2111
     Multivariate normal and t distributions.
2101
 
2112
 
2102
*ncdf*
2113
*ncdf*
2103
     Interface to Unidata netCDF data files.
2114
     Interface to Unidata netCDF data files.
2104
 
2115
 
2105
*ncomplete*
2116
*ncomplete*
2106
     Functions to perform the regression depth method (RDM) to binary
2117
     Functions to perform the regression depth method (RDM) to binary
2107
     regression to approximate the minimum number of observations that can
2118
     regression to approximate the minimum number of observations that can
2108
     be removed such that the reduced data set has complete separation.
2119
     be removed such that the reduced data set has complete separation.
2109
 
2120
 
2110
*negenes*
2121
*negenes*
2111
     Estimating the number of essential genes in a genome on the basis of
2122
     Estimating the number of essential genes in a genome on the basis of
2112
     data from a random transposon mutagenesis experiment, through the use
2123
     data from a random transposon mutagenesis experiment, through the use
2113
     of a Gibbs sampler.
2124
     of a Gibbs sampler.
2114
 
2125
 
2115
*netCDF*
2126
*netCDF*
2116
     Read data from netCDF files.
2127
     Read data from netCDF files.
2117
 
2128
 
2118
*nlme*
2129
*nlme*
2119
     Fit and compare Gaussian linear and nonlinear mixed-effects models.
2130
     Fit and compare Gaussian linear and nonlinear mixed-effects models.
2120
     _Recommended_.
2131
     _Recommended_.
2121
 
2132
 
2122
*nlmeODE*
2133
*nlmeODE*
2123
     Combine the *nlme* and *odesolve* packages for mixed-effects modelling
2134
     Combine the *nlme* and *odesolve* packages for mixed-effects modelling
2124
     using differential equations.
2135
     using differential equations.
2125
 
2136
 
2126
*nlrq*
2137
*nlrq*
2127
     Nonlinear quantile regression.
2138
     Nonlinear quantile regression.
2128
 
2139
 
2129
*nnet*
2140
*nnet*
2130
     Software for single hidden layer perceptrons ("feed-forward neural
2141
     Software for single hidden layer perceptrons ("feed-forward neural
2131
     networks"), and for multinomial log-linear models.  Contained in the
2142
     networks"), and for multinomial log-linear models.  Contained in the
2132
     `VR' bundle.  _Recommended_.
2143
     `VR' bundle.  _Recommended_.
2133
 
2144
 
2134
*nor1mix*
2145
*nor1mix*
2135
     One-dimensional normal mixture models classes, for, e.g., density
2146
     One-dimensional normal mixture models classes, for, e.g., density
2136
     estimation or clustering algorithms research and teaching; providing
2147
     estimation or clustering algorithms research and teaching; providing
2137
     the widely used Marron-Wand densities.
2148
     the widely used Marron-Wand densities.
2138
 
2149
 
2139
*norm*
2150
*norm*
2140
     Analysis of multivariate normal datasets with missing values.
2151
     Analysis of multivariate normal datasets with missing values.
2141
 
2152
 
2142
*normalp*
2153
*normalp*
2143
     A collection of utilities for normal of order p distributions (General
2154
     A collection of utilities for normal of order p distributions (General
2144
     Error Distributions).
2155
     Error Distributions).
2145
 
2156
 
2146
*nortest*
2157
*nortest*
2147
     Five omnibus tests for the composite hypothesis of normality.
2158
     Five omnibus tests for the composite hypothesis of normality.
2148
 
2159
 
2149
*noverlap*
2160
*noverlap*
2150
     Functions to perform the regression depth method (RDM) to binary
2161
     Functions to perform the regression depth method (RDM) to binary
2151
     regression to approximate the amount of overlap, i.e., the minimal
2162
     regression to approximate the amount of overlap, i.e., the minimal
2152
     number of observations that need to be removed such that the reduced
2163
     number of observations that need to be removed such that the reduced
2153
     data set has no longer overlap.
2164
     data set has no longer overlap.
2154
 
2165
 
2155
*npmc*
2166
*npmc*
2156
     Nonparametric Multiple Comparisons:  provides simultaneous rank test
2167
     Nonparametric Multiple Comparisons:  provides simultaneous rank test
2157
     procedures for the one-way layout without presuming a certain
2168
     procedures for the one-way layout without presuming a certain
2158
     distribution.
2169
     distribution.
2159
 
2170
 
2160
*nprq*
2171
*nprq*
2161
     Nonparametric and sparse quantile regression methods.
2172
     Nonparametric and sparse quantile regression methods.
2162
 
2173
 
2163
*odesolve*
2174
*odesolve*
2164
     An interface for the Ordinary Differential Equation (ODE) solver lsoda.
2175
     An interface for the Ordinary Differential Equation (ODE) solver lsoda.
2165
     ODEs are expressed as R functions.
2176
     ODEs are expressed as R functions.
2166
 
2177
 
2167
*orientlib*
2178
*orientlib*
2168
     Representations, conversions and display of orientation SO(3) data.
2179
     Representations, conversions and display of orientation SO(3) data.
2169
 
2180
 
2170
*oz*
2181
*oz*
2171
     Functions for plotting Australia's coastline and state boundaries.
2182
     Functions for plotting Australia's coastline and state boundaries.
2172
 
2183
 
2173
*pamr*
2184
*pamr*
2174
     Pam: Prediction Analysis for Microarrays.
2185
     Pam: Prediction Analysis for Microarrays.
2175
 
2186
 
2176
*pan*
2187
*pan*
2177
     Multiple imputation for multivariate panel or clustered data.
2188
     Multiple imputation for multivariate panel or clustered data.
2178
 
2189
 
2179
*panel*
2190
*panel*
2180
     Functions and datasets for fitting models to Panel data.
2191
     Functions and datasets for fitting models to Panel data.
2181
 
2192
 
2182
*pastecs*
2193
*pastecs*
2183
     Package for Analysis of Space-Time Ecological Series.
2194
     Package for Analysis of Space-Time Ecological Series.
2184
 
2195
 
2185
*pcurve*
2196
*pcurve*
2186
     Fits a principal curve to a numeric multivariate dataset in arbitrary
2197
     Fits a principal curve to a numeric multivariate dataset in arbitrary
2187
     dimensions.  Produces diagnostic plots.  Also calculates Bray-Curtis
2198
     dimensions.  Produces diagnostic plots.  Also calculates Bray-Curtis
2188
     and other distance matrices and performs multi-dimensional scaling and
2199
     and other distance matrices and performs multi-dimensional scaling and
2189
     principal component analyses.
2200
     principal component analyses.
2190
 
2201
 
2191
*pear*
2202
*pear*
2192
     Periodic Autoregression Analysis.
2203
     Periodic Autoregression Analysis.
2193
 
2204
 
2194
*permax*
2205
*permax*
2195
     Functions intended to facilitate certain basic analyses of DNA array
2206
     Functions intended to facilitate certain basic analyses of DNA array
2196
     data, especially with regard to comparing expression levels between two
2207
     data, especially with regard to comparing expression levels between two
2197
     types of tissue.
2208
     types of tissue.
2198
 
2209
 
2199
*pheno*
2210
*pheno*
2200
     Some easy-to-use functions for time series analyses of (plant-)
2211
     Some easy-to-use functions for time series analyses of (plant-)
2201
     phenological data sets.
2212
     phenological data sets.
2202
 
2213
 
2203
*phyloarray*
2214
*phyloarray*
2204
     Software to process data from phylogenetic or identification
2215
     Software to process data from phylogenetic or identification
2205
     microarrays.
2216
     microarrays.
2206
 
2217
 
2207
*pinktoe*
2218
*pinktoe*
2208
     Converts S trees to HTML/Perl files for interactive tree traversal.
2219
     Converts S trees to HTML/Perl files for interactive tree traversal.
2209
 
2220
 
2210
*pixmap*
2221
*pixmap*
2211
     Functions for import, export, plotting and other manipulations of
2222
     Functions for import, export, plotting and other manipulations of
2212
     bitmapped images.
2223
     bitmapped images.
2213
 
2224
 
2214
*pls.pcr*
2225
*pls.pcr*
2215
     Multivariate regression by PLS and PCR.
2226
     Multivariate regression by PLS and PCR.
2216
 
2227
 
2217
*polspline*
2228
*polspline*
2218
     Routines for the polynomial spline fitting routines hazard regression,
2229
     Routines for the polynomial spline fitting routines hazard regression,
2219
     hazard estimation with flexible tails, logspline, lspec, polyclass, and
2230
     hazard estimation with flexible tails, logspline, lspec, polyclass, and
2220
     polymars, by C. Kooperberg and co-authors.
2231
     polymars, by C. Kooperberg and co-authors.
2221
 
2232
 
2222
*polynom*
2233
*polynom*
2223
     A collection of functions to implement a class for univariate
2234
     A collection of functions to implement a class for univariate
2224
     polynomial manipulations.
2235
     polynomial manipulations.
2225
 
2236
 
2226
*pps*
2237
*pps*
2227
     Functions to select samples using PPS (probability proportional to
2238
     Functions to select samples using PPS (probability proportional to
2228
     size) sampling, for stratified simple random sampling, and to compute
2239
     size) sampling, for stratified simple random sampling, and to compute
2229
     joint inclusion probabilities for Sampford's method of PPS sampling.
2240
     joint inclusion probabilities for Sampford's method of PPS sampling.
2230
 
2241
 
2231
*prabclus*
2242
*prabclus*
2232
     Distance based parametric bootstrap tests for clustering, mainly
2243
     Distance based parametric bootstrap tests for clustering, mainly
2233
     thought for presence-absence data (clustering of species distribution
2244
     thought for presence-absence data (clustering of species distribution
2234
     maps).  Jaccard and Kulczynski distance measures, clustering of MDS
2245
     maps).  Jaccard and Kulczynski distance measures, clustering of MDS
2235
     scores, and nearest neighbor based noise detection.
2246
     scores, and nearest neighbor based noise detection.
2236
 
2247
 
2237
*princurve*
2248
*princurve*
2238
     Fits a principal curve to a matrix of points in arbitrary dimension.
2249
     Fits a principal curve to a matrix of points in arbitrary dimension.
2239
 
2250
 
2240
*pspline*
2251
*pspline*
2241
     Smoothing splines with penalties on order m derivatives.
2252
     Smoothing splines with penalties on order m derivatives.
2242
 
2253
 
2243
*psy*
2254
*psy*
2244
     Various procedures used in psychometry: Kappa, ICC, Cronbach alpha,
2255
     Various procedures used in psychometry: Kappa, ICC, Cronbach alpha,
2245
     screeplot, PCA and related methods.
2256
     screeplot, PCA and related methods.
2246
 
2257
 
2247
*qtl*
2258
*qtl*
2248
     Analysis of experimental crosses to identify QTLs.
2259
     Analysis of experimental crosses to identify QTLs.
2249
 
2260
 
2250
*quadprog*
2261
*quadprog*
2251
     For solving quadratic programming problems.
2262
     For solving quadratic programming problems.
2252
 
2263
 
2253
*quantreg*
2264
*quantreg*
2254
     Quantile regression and related methods.
2265
     Quantile regression and related methods.
2255
 
2266
 
2256
*qvcalc*
2267
*qvcalc*
2257
     Functions to compute quasi-variances and associated measures of
2268
     Functions to compute quasi-variances and associated measures of
2258
     approximation error.
2269
     approximation error.
2259
 
2270
 
2260
*randomForest*
2271
*randomForest*
2261
     Breiman's random forest classifier.
2272
     Breiman's random forest classifier.
2262
 
2273
 
-
 
2274
*ref*
-
 
2275
     Functions for creating references, reading from and writing ro
-
 
2276
     references and a memory efficient refdata type that transparently
-
 
2277
     encapsulates matrices and data frames.
-
 
2278
 
2263
*relimp*
2279
*relimp*
2264
     Functions to facilitate inference on the relative importance of
2280
     Functions to facilitate inference on the relative importance of
2265
     predictors in a linear or generalized linear model.
2281
     predictors in a linear or generalized linear model.
2266
 
2282
 
2267
*rgdal*
2283
*rgdal*
2268
     Provides bindings to Frank Warmerdam's Geospatial Data Abstraction
2284
     Provides bindings to Frank Warmerdam's Geospatial Data Abstraction
2269
     Library (GDAL).
2285
     Library (GDAL).
2270
 
2286
 
2271
*rgenoud*
2287
*rgenoud*
2272
     R version of GENetic Optimization Using Derivatives.
2288
     R version of GENetic Optimization Using Derivatives.
2273
 
2289
 
2274
*rimage*
2290
*rimage*
2275
     Functions for image processing, including Sobel filter, rank filters,
2291
     Functions for image processing, including Sobel filter, rank filters,
2276
     fft, histogram equalization, and reading JPEG files.
2292
     fft, histogram equalization, and reading JPEG files.
2277
 
2293
 
2278
*rmeta*
2294
*rmeta*
2279
     Functions for simple fixed and random effects meta-analysis for
2295
     Functions for simple fixed and random effects meta-analysis for
2280
     two-sample comparison of binary outcomes.
2296
     two-sample comparison of binary outcomes.
2281
 
2297
 
2282
*rpart*
2298
*rpart*
2283
     Recursive PARTitioning and regression trees.  _Recommended_.
2299
     Recursive PARTitioning and regression trees.  _Recommended_.
2284
 
2300
 
2285
*rpvm*
2301
*rpvm*
2286
     R interface to PVM (Parallel Virtual Machine).  Provides interface to
2302
     R interface to PVM (Parallel Virtual Machine).  Provides interface to
2287
     PVM APIs, and examples and documentation for its use.
2303
     PVM APIs, and examples and documentation for its use.
2288
 
2304
 
2289
*rqmcmb2*
2305
*rqmcmb2*
2290
     Markov chain marginal bootstrap for quantile regression.
2306
     Markov chain marginal bootstrap for quantile regression.
2291
 
2307
 
2292
*rsprng*
2308
*rsprng*
2293
     Provides interface to SPRNG (Scalable Parallel Random Number
2309
     Provides interface to SPRNG (Scalable Parallel Random Number
2294
     Generators) APIs, and examples and documentation for its use.
2310
     Generators) APIs, and examples and documentation for its use.
2295
 
2311
 
2296
*sampfling*
2312
*sampfling*
2297
     Implements a modified version of the Sampford sampling algorithm.
2313
     Implements a modified version of the Sampford sampling algorithm.
2298
     Given a quantity assigned to each unit in the population, samples are
2314
     Given a quantity assigned to each unit in the population, samples are
2299
     drawn with probability proportional to te product of the quantities of
2315
     drawn with probability proportional to te product of the quantities of
2300
     the units included in the sample.
2316
     the units included in the sample.
2301
 
2317
 
2302
*sca*
2318
*sca*
2303
     Simple Component Analysis.
2319
     Simple Component Analysis.
2304
 
2320
 
2305
*scatterplot3d*
2321
*scatterplot3d*
2306
     Plots a three dimensional (3D) point cloud perspectively.
2322
     Plots a three dimensional (3D) point cloud perspectively.
2307
 
2323
 
2308
*seacarb*
2324
*seacarb*
2309
     Calculates parameters of the seawater carbonate system.
2325
     Calculates parameters of the seawater carbonate system.
2310
 
2326
 
2311
*seao*
2327
*seao*
2312
     Simple Evolutionary Algorithm Optimization.
2328
     Simple Evolutionary Algorithm Optimization.
2313
 
2329
 
2314
*seao.gui*
2330
*seao.gui*
2315
     Simple Evolutionary Algorithm Optimization: graphical user interface.
2331
     Simple Evolutionary Algorithm Optimization: graphical user interface.
2316
 
2332
 
2317
*segmented*
2333
*segmented*
2318
     Functions to estimate break-points of segmented relationships in
2334
     Functions to estimate break-points of segmented relationships in
2319
     regression models (GLMs).
2335
     regression models (GLMs).
2320
 
2336
 
2321
*sem*
2337
*sem*
2322
     Functions for fitting general linear Structural Equation Models (with
2338
     Functions for fitting general linear Structural Equation Models (with
2323
     observed and unobserved variables) by the method of maximum likelihood
2339
     observed and unobserved variables) by the method of maximum likelihood
2324
     using the RAM approach.
2340
     using the RAM approach.
2325
 
2341
 
2326
*serialize*
2342
*serialize*
2327
     Simple interfce for serializing to connections.
2343
     Simple interfce for serializing to connections.
2328
 
2344
 
2329
*session*
2345
*session*
2330
     Functions for interacting with, saving and restoring R sessions.
2346
     Functions for interacting with, saving and restoring R sessions.
2331
 
2347
 
2332
*sgeostat*
2348
*sgeostat*
2333
     An object-oriented framework for geostatistical modeling.
2349
     An object-oriented framework for geostatistical modeling.
2334
 
2350
 
2335
*shapefiles*
2351
*shapefiles*
2336
     Functions to read and write ESRI shapefiles.
2352
     Functions to read and write ESRI shapefiles.
2337
 
2353
 
2338
*shapes*
2354
*shapes*
2339
     Routines for the statistical analysis of shapes, including procrustes
2355
     Routines for the statistical analysis of shapes, including procrustes
2340
     analysis, displaying shapes and principal components, testing for mean
2356
     analysis, displaying shapes and principal components, testing for mean
2341
     shape difference, thin-plate spline transformation grids and edge
2357
     shape difference, thin-plate spline transformation grids and edge
2342
     superimposition methods.
2358
     superimposition methods.
2343
 
2359
 
2344
*simpleboot*
2360
*simpleboot*
2345
     Simple bootstrap routines.
2361
     Simple bootstrap routines.
2346
 
2362
 
2347
*sm*
2363
*sm*
2348
     Software linked to the book "Applied Smoothing Techniques for Data
2364
     Software linked to the book "Applied Smoothing Techniques for Data
2349
     Analysis:  The Kernel Approach with S-PLUS Illustrations" by A. W.
2365
     Analysis:  The Kernel Approach with S-PLUS Illustrations" by A. W.
2350
     Bowman and A. Azzalini (1997), Oxford University Press.
2366
     Bowman and A. Azzalini (1997), Oxford University Press.
2351
 
2367
 
2352
*sma*
2368
*sma*
2353
     Functions for exploratory (statistical) microarray analysis.
2369
     Functions for exploratory (statistical) microarray analysis.
2354
 
2370
 
2355
*smoothSurv*
2371
*smoothSurv*
2356
     Survival regression with smoothed error distribution.
2372
     Survival regression with smoothed error distribution.
2357
 
2373
 
2358
*sn*
2374
*sn*
2359
     Functions for manipulating skew-normal probability distributions and
2375
     Functions for manipulating skew-normal probability distributions and
2360
     for fitting them to data, in the scalar and the multivariate case.
2376
     for fitting them to data, in the scalar and the multivariate case.
2361
 
2377
 
2362
*sna*
2378
*sna*
2363
     A range of tools for social network analysis, including node and
2379
     A range of tools for social network analysis, including node and
2364
     graph-level indices, structural distance and covariance methods,
2380
     graph-level indices, structural distance and covariance methods,
2365
     structural equivalence detection, p* modeling, and network
2381
     structural equivalence detection, p* modeling, and network
2366
     visualization.
2382
     visualization.
2367
 
2383
 
2368
*snow*
2384
*snow*
2369
     Simple Network of Workstations: support for simple parallel computing
2385
     Simple Network of Workstations: support for simple parallel computing
2370
     in R.
2386
     in R.
2371
 
2387
 
2372
*som*
2388
*som*
2373
     Self-Organizing Maps (with application in gene clustering).
2389
     Self-Organizing Maps (with application in gene clustering).
2374
 
2390
 
2375
*sound*
2391
*sound*
2376
     A sound interface for R: Basic functions for dealing with `.wav' files
2392
     A sound interface for R: Basic functions for dealing with `.wav' files
2377
     and sound samples.
2393
     and sound samples.
2378
 
2394
 
2379
*spatial*
2395
*spatial*
2380
     Functions for kriging and point pattern analysis from "Modern Applied
2396
     Functions for kriging and point pattern analysis from "Modern Applied
2381
     Statistics with S" by W. Venables and B. Ripley.  Contained in the
2397
     Statistics with S" by W. Venables and B. Ripley.  Contained in the
2382
     `VR' bundle.  _Recommended_.
2398
     `VR' bundle.  _Recommended_.
2383
 
2399
 
2384
*spatstat*
2400
*spatstat*
2385
     Data analysis and modelling of two-dimensional point patterns,
2401
     Data analysis and modelling of two-dimensional point patterns,
2386
     including multitype points and spatial covariates.
2402
     including multitype points and spatial covariates.
2387
 
2403
 
2388
*spdep*
2404
*spdep*
2389
     A collection of functions to create spatial weights matrix objects from
2405
     A collection of functions to create spatial weights matrix objects from
2390
     polygon contiguities, from point patterns by distance and tesselations,
2406
     polygon contiguities, from point patterns by distance and tesselations,
2391
     for summarising these objects, and for permitting their use in spatial
2407
     for summarising these objects, and for permitting their use in spatial
2392
     data analysis; a collection of tests for spatial autocorrelation,
2408
     data analysis; a collection of tests for spatial autocorrelation,
2393
     including global Moran's I and Geary's C, local Moran's I, saddlepoint
2409
     including global Moran's I and Geary's C, local Moran's I, saddlepoint
2394
     approximations for global and local Moran's I; and functions for
2410
     approximations for global and local Moran's I; and functions for
2395
     estimating spatial simultaneous autoregressive (SAR) models.  (Was
2411
     estimating spatial simultaneous autoregressive (SAR) models.  (Was
2396
     formerly the three packages: *spweights*, *sptests*, and *spsarlm*.)
2412
     formerly the three packages: *spweights*, *sptests*, and *spsarlm*.)
2397
 
2413
 
2398
*splancs*
2414
*splancs*
2399
     Spatial and space-time point pattern analysis functions.
2415
     Spatial and space-time point pattern analysis functions.
2400
 
2416
 
2401
*statmod*
2417
*statmod*
2402
     Miscellaneous biostatistical modelling functions.
2418
     Miscellaneous biostatistical modelling functions.
2403
 
2419
 
2404
*strucchange*
2420
*strucchange*
2405
     Various tests on structural change in linear regression models.
2421
     Various tests on structural change in linear regression models.
2406
 
2422
 
2407
*subselect*
2423
*subselect*
2408
     A collection of functions which assess the quality of variable subsets
2424
     A collection of functions which assess the quality of variable subsets
2409
     as surrogates for a full data set, and search for subsets which are
2425
     as surrogates for a full data set, and search for subsets which are
2410
     optimal under various criteria.
2426
     optimal under various criteria.
2411
 
2427
 
2412
*supclust*
2428
*supclust*
2413
     Methodology for supervised grouping of predictor variables.
2429
     Methodology for supervised grouping of predictor variables.
2414
 
2430
 
2415
*survey*
2431
*survey*
2416
     Summary statistics, generalized linear models, and general maximum
2432
     Summary statistics, generalized linear models, and general maximum
2417
     likelihood estimation for stratified, cluster-sampled, unequally
2433
     likelihood estimation for stratified, cluster-sampled, unequally
2418
     weighted survey samples.
2434
     weighted survey samples.
2419
 
2435
 
2420
*survival*
2436
*survival*
2421
     Functions for survival analysis, including penalised likelihood.
2437
     Functions for survival analysis, including penalised likelihood.
2422
     _Recommended_.
2438
     _Recommended_.
2423
 
2439
 
2424
*survrec*
2440
*survrec*
2425
     Survival analysis for recurrent event data.
2441
     Survival analysis for recurrent event data.
2426
 
2442
 
2427
*systemfit*
2443
*systemfit*
2428
     Contains functions for fitting simultaneous systems of equations using
2444
     Contains functions for fitting simultaneous systems of equations using
2429
     Ordinary Least Sqaures (OLS), Two-Stage Least Squares (2SLS), and
2445
     Ordinary Least Sqaures (OLS), Two-Stage Least Squares (2SLS), and
2430
     Three-Stage Least Squares (3SLS).
2446
     Three-Stage Least Squares (3SLS).
2431
 
2447
 
2432
*tapiR*
2448
*tapiR*
2433
     Tools for accessing (UK) parliamentary information in R.
2449
     Tools for accessing (UK) parliamentary information in R.
2434
 
2450
 
2435
*tensor*
2451
*tensor*
2436
     Tensor product of arrays.
2452
     Tensor product of arrays.
2437
 
2453
 
2438
*tkrplot*
2454
*tkrplot*
2439
     Simple mechanism for placing R graphics in a Tk widget.
2455
     Simple mechanism for placing R graphics in a Tk widget.
2440
 
2456
 
2441
*tree*
2457
*tree*
2442
     Classification and regression trees.
2458
     Classification and regression trees.
2443
 
2459
 
2444
*tripack*
2460
*tripack*
2445
     A constrained two-dimensional Delaunay triangulation package.
2461
     A constrained two-dimensional Delaunay triangulation package.
2446
 
2462
 
2447
*tseries*
2463
*tseries*
2448
     Package for time series analysis with emphasis on non-linear modelling.
2464
     Package for time series analysis with emphasis on non-linear modelling.
2449
 
2465
 
2450
*twostage*
2466
*twostage*
2451
     Functions for optimal design of two-stage-studies using the Mean Score
2467
     Functions for optimal design of two-stage-studies using the Mean Score
2452
     method.
2468
     method.
2453
 
2469
 
2454
*udunits*
2470
*udunits*
2455
     Interface to Unidata's routines to convert units.
2471
     Interface to Unidata's routines to convert units.
2456
 
2472
 
2457
*vardiag*
2473
*vardiag*
2458
     Interactive variogram diagnostics.
2474
     Interactive variogram diagnostics.
2459
 
2475
 
2460
*vcd*
2476
*vcd*
2461
     Functions and data sets based on the book "Visualizing Categorical
2477
     Functions and data sets based on the book "Visualizing Categorical
2462
     Data" by Michael Friendly.
2478
     Data" by Michael Friendly.
2463
 
2479
 
2464
*vegan*
2480
*vegan*
2465
     Various help functions for vegetation scientists and community
2481
     Various help functions for vegetation scientists and community
2466
     ecologists.
2482
     ecologists.
2467
 
2483
 
2468
*waveslim*
2484
*waveslim*
2469
     Basic wavelet routines for time series analysis.
2485
     Basic wavelet routines for time series analysis.
2470
 
2486
 
2471
*wavethresh*
2487
*wavethresh*
2472
     Software to perform 1-d and 2-d wavelet statistics and transforms.
2488
     Software to perform 1-d and 2-d wavelet statistics and transforms.
2473
 
2489
 
2474
*wle*
2490
*wle*
2475
     Robust statistical inference via a weighted likelihood approach.
2491
     Robust statistical inference via a weighted likelihood approach.
2476
 
2492
 
2477
*xgobi*
2493
*xgobi*
2478
     Interface to the XGobi and XGvis programs for graphical data analysis.
2494
     Interface to the XGobi and XGvis programs for graphical data analysis.
2479
 
2495
 
2480
*xtable*
2496
*xtable*
2481
     Export data to LaTeX and HTML tables.
2497
     Export data to LaTeX and HTML tables.
2482
 
2498
 
2483
See CRAN `src/contrib/PACKAGES' for more information.
2499
See CRAN `src/contrib/PACKAGES' for more information.
2484
 
2500
 
2485
   There is also a CRAN `src/contrib/Devel' directory which contains
2501
   There is also a CRAN `src/contrib/Devel' directory which contains
2486
packages still "under development" or depending on features only present in
2502
packages still "under development" or depending on features only present in
2487
the current development versions of R.  Volunteers are invited to give
2503
the current development versions of R.  Volunteers are invited to give
2488
these a try, of course.  This area of CRAN currently contains
2504
these a try, of course.  This area of CRAN currently contains
2489
 
2505
 
2490
*Dopt*
2506
*Dopt*
2491
     Finding D-optimal experimental designs.
2507
     Finding D-optimal experimental designs.
2492
 
2508
 
2493
*GLMMGibbs*
2509
*GLMMGibbs*
2494
     Generalised Linear Mixed Models by Gibbs sampling.
2510
     Generalised Linear Mixed Models by Gibbs sampling.
2495
 
2511
 
2496
*RPgSQL*
2512
*RPgSQL*
2497
     Provides methods for accessing data stored in PostgreSQL tables.
2513
     Provides methods for accessing data stored in PostgreSQL tables.
2498
 
2514
 
2499
*Rmpi*
2515
*Rmpi*
2500
     An interface (wrapper) to MPI (Message-Passing Interface) APIs.  It
2516
     An interface (wrapper) to MPI (Message-Passing Interface) APIs.  It
2501
     also provides interactive R slave functionalities to make MPI
2517
     also provides interactive R slave functionalities to make MPI
2502
     programming easier in R than in C(++) or FORTRAN.
2518
     programming easier in R than in C(++) or FORTRAN.
2503
 
2519
 
2504
*dseplus*
2520
*dseplus*
2505
     Extensions to *dse*, the Dynamic Systems Estimation multivariate time
2521
     Extensions to *dse*, the Dynamic Systems Estimation multivariate time
2506
     series package.  Contains PADI, juice and monitoring extensions.
2522
     series package.  Contains PADI, juice and monitoring extensions.
2507
 
2523
 
2508
*ensemble*
2524
*ensemble*
2509
     Ensembles of tree classifiers.
2525
     Ensembles of tree classifiers.
2510
 
2526
 
2511
*runStat*
2527
*runStat*
2512
     Running median and mean.
2528
     Running median and mean.
2513
 
2529
 
2514
*write.snns*
2530
*write.snns*
2515
     Function for writing a SNNS pattern file from a data frame or matrix.
2531
     Function for writing a SNNS pattern file from a data frame or matrix.
2516
 
2532
 
2517
5.1.3 Add-on packages from Omegahat
2533
5.1.3 Add-on packages from Omegahat
2518
-----------------------------------
2534
-----------------------------------
2519
 
2535
 
2520
The `src/contrib/Omegahat' Directory of a CRAN site contains yet unreleased
2536
The `src/contrib/Omegahat' Directory of a CRAN site contains yet unreleased
2521
packages from the Omegahat Project for Statistical Computing
2537
packages from the Omegahat Project for Statistical Computing
2522
(http://www.omegahat.org/).  Currently, there are
2538
(http://www.omegahat.org/).  Currently, there are
2523
 
2539
 
2524
*CORBA*
2540
*CORBA*
2525
     Dynamic CORBA client/server facilities for R.  Connects to other
2541
     Dynamic CORBA client/server facilities for R.  Connects to other
2526
     CORBA-aware applications developed in arbitrary languages, on different
2542
     CORBA-aware applications developed in arbitrary languages, on different
2527
     machines and allows R functionality to be exported in the same way to
2543
     machines and allows R functionality to be exported in the same way to
2528
     other applications.
2544
     other applications.
2529
 
2545
 
2530
*OOP*
2546
*OOP*
2531
     OOP style classes and methods for R and S-PLUS.  Object references and
2547
     OOP style classes and methods for R and S-PLUS.  Object references and
2532
     class-based method definition are supported in the style of languages
2548
     class-based method definition are supported in the style of languages
2533
     such as Java and C++.
2549
     such as Java and C++.
2534
 
2550
 
2535
*REmbeddedPostgres*
2551
*REmbeddedPostgres*
2536
     Allows R functions and objects to be used to implement SQL functions --
2552
     Allows R functions and objects to be used to implement SQL functions --
2537
     per-record, aggregate and trigger functions.
2553
     per-record, aggregate and trigger functions.
2538
 
2554
 
2539
*REventLoop*
2555
*REventLoop*
2540
     An abstract event loop mechanism that is toolkit independent and can be
2556
     An abstract event loop mechanism that is toolkit independent and can be
2541
     used to to replace the R event loop.
2557
     used to to replace the R event loop.
2542
 
2558
 
2543
*RGdkPixbuf*
2559
*RGdkPixbuf*
2544
     S language functions to access the facilities in the GdkPixbuf library
2560
     S language functions to access the facilities in the GdkPixbuf library
2545
     for manipulating images.
2561
     for manipulating images.
2546
 
2562
 
2547
*RGnumeric*
2563
*RGnumeric*
2548
     A plugin for the Gnumeric spreadsheet that allows R functions to be
2564
     A plugin for the Gnumeric spreadsheet that allows R functions to be
2549
     called from cells within the sheet, automatic recalculation, etc.
2565
     called from cells within the sheet, automatic recalculation, etc.
2550
 
2566
 
2551
*RGtk*
2567
*RGtk*
2552
     Facilities in the S language for programming graphical interfaces using
2568
     Facilities in the S language for programming graphical interfaces using
2553
     Gtk, the Gnome GUI toolkit.
2569
     Gtk, the Gnome GUI toolkit.
2554
 
2570
 
2555
*RGtkBindingGenerator*
2571
*RGtkBindingGenerator*
2556
     A meta-package which generates C and R code to provide bindings to a
2572
     A meta-package which generates C and R code to provide bindings to a
2557
     Gtk-based library.
2573
     Gtk-based library.
2558
 
2574
 
2559
*RGtkExtra*
2575
*RGtkExtra*
2560
     A collection of S functions that provide an interface to the widgets in
2576
     A collection of S functions that provide an interface to the widgets in
2561
     the gtk+extra library such as the GtkSheet data-grid display, icon
2577
     the gtk+extra library such as the GtkSheet data-grid display, icon
2562
     list, file list and directory tree.
2578
     list, file list and directory tree.
2563
 
2579
 
2564
*RGtkGlade*
2580
*RGtkGlade*
2565
     S language bindings providing an interface to Glade, the interactive
2581
     S language bindings providing an interface to Glade, the interactive
2566
     Gnome GUI creator.
2582
     Gnome GUI creator.
2567
 
2583
 
2568
*RGtkHTML*
2584
*RGtkHTML*
2569
     A collection of S functions that provide an interface to creating and
2585
     A collection of S functions that provide an interface to creating and
2570
     controlling an HTML widget which can be used to display HTML documents
2586
     controlling an HTML widget which can be used to display HTML documents
2571
     from files or content generated dynamically in S.
2587
     from files or content generated dynamically in S.
2572
 
2588
 
2573
*RGtkViewers*
2589
*RGtkViewers*
2574
     A collection of tools for viewing different S objects, databases, class
2590
     A collection of tools for viewing different S objects, databases, class
2575
     and widget hierarchies, S source file contents, etc.
2591
     and widget hierarchies, S source file contents, etc.
2576
 
2592
 
2577
*RJavaDevice*
2593
*RJavaDevice*
2578
     A graphics device for R that uses Java components and graphics.  APIs.
2594
     A graphics device for R that uses Java components and graphics.  APIs.
2579
 
2595
 
2580
*RObjectTables*
2596
*RObjectTables*
2581
     The C and S code allows one to define R objects to be used as elements
2597
     The C and S code allows one to define R objects to be used as elements
2582
     of the search path with their own semantics and facilities for reading
2598
     of the search path with their own semantics and facilities for reading
2583
     and writing variables.  The objects implement a simple interface via R
2599
     and writing variables.  The objects implement a simple interface via R
2584
     functions (either methods or closures) and can access external data,
2600
     functions (either methods or closures) and can access external data,
2585
     e.g., in other applications, languages, formats, ...
2601
     e.g., in other applications, languages, formats, ...
2586
 
2602
 
2587
*RSMethods*
2603
*RSMethods*
2588
     An implementation of S version 4 methods and classes for R, consistent
2604
     An implementation of S version 4 methods and classes for R, consistent
2589
     with the basic material in "Programming with Data" by John M.
2605
     with the basic material in "Programming with Data" by John M.
2590
     Chambers, 1998, Springer NY.
2606
     Chambers, 1998, Springer NY.
2591
 
2607
 
2592
*RSPerl*
2608
*RSPerl*
2593
     An interface from R to an embedded, persistent Perl interpreter,
2609
     An interface from R to an embedded, persistent Perl interpreter,
2594
     allowing one to call arbitrary Perl subroutines, classes and methods.
2610
     allowing one to call arbitrary Perl subroutines, classes and methods.
2595
 
2611
 
2596
*RSPython*
2612
*RSPython*
2597
     Allows Python programs to invoke S functions, methods, etc., and S code
2613
     Allows Python programs to invoke S functions, methods, etc., and S code
2598
     to call Python functionality.
2614
     to call Python functionality.
2599
 
2615
 
2600
*RXLisp*
2616
*RXLisp*
2601
     An interface to call XLisp-Stat functions from within R.
2617
     An interface to call XLisp-Stat functions from within R.
2602
 
2618
 
2603
*SASXML*
2619
*SASXML*
2604
     Example for reading XML files in SAS 8.2 manner.
2620
     Example for reading XML files in SAS 8.2 manner.
2605
 
2621
 
2606
*SJava*
2622
*SJava*
2607
     An interface from R to Java to create and call Java objects and
2623
     An interface from R to Java to create and call Java objects and
2608
     methods.
2624
     methods.
2609
 
2625
 
2610
*SLanguage*
2626
*SLanguage*
2611
     Functions and C support utilities to support S language programming
2627
     Functions and C support utilities to support S language programming
2612
     that can work in both R and S-PLUS.
2628
     that can work in both R and S-PLUS.
2613
 
2629
 
2614
*SNetscape*
2630
*SNetscape*
2615
     Plugin for Netscape and JavaScript.
2631
     Plugin for Netscape and JavaScript.
2616
 
2632
 
2617
*SWinRegistry*
2633
*SWinRegistry*
2618
     Provides access from within R to read and write the Windows registry.
2634
     Provides access from within R to read and write the Windows registry.
2619
 
2635
 
2620
*SWinTypeLibs*
2636
*SWinTypeLibs*
2621
     Provides ways to extract type information from type libraries and/or
2637
     Provides ways to extract type information from type libraries and/or
2622
     DCOM objects that describes the methods, properties, etc. of an
2638
     DCOM objects that describes the methods, properties, etc. of an
2623
     interface.
2639
     interface.
2624
 
2640
 
2625
*SXalan*
2641
*SXalan*
2626
     Process XML documents using XSL functions implemented in R and
2642
     Process XML documents using XSL functions implemented in R and
2627
     dynamically substituting output from R.
2643
     dynamically substituting output from R.
2628
 
2644
 
2629
*Slcc*
2645
*Slcc*
2630
     Parses C source code, allowing one to analyze and automatically
2646
     Parses C source code, allowing one to analyze and automatically
2631
     generate interfaces from S to that code, including the table of
2647
     generate interfaces from S to that code, including the table of
2632
     S-accessible native symbols, parameter count and type information, S
2648
     S-accessible native symbols, parameter count and type information, S
2633
     constructors from C objects, call graphs, etc.
2649
     constructors from C objects, call graphs, etc.
2634
 
2650
 
2635
*Sxslt*
2651
*Sxslt*
2636
     An extension module for libxslt, the XML-XSL document translator, that
2652
     An extension module for libxslt, the XML-XSL document translator, that
2637
     allows XSL functions to be implemented via R functions.
2653
     allows XSL functions to be implemented via R functions.
2638
 
2654
 
2639
5.1.4 Add-on packages from BioConductor
2655
5.1.4 Add-on packages from BioConductor
2640
---------------------------------------
2656
---------------------------------------
2641
 
2657
 
2642
The Bioconductor Project (http://www.bioconductor.org) produces an open
2658
The Bioconductor Project (http://www.bioconductor.org) produces an open
2643
source software framework that will assist biologists and statisticians
2659
source software framework that will assist biologists and statisticians
2644
working in bioinformatics, with primary emphasis on inference using DNA
2660
working in bioinformatics, with primary emphasis on inference using DNA
2645
microarrays.  The following R packages are contained in the current release
2661
microarrays.  The following R packages are contained in the current release
2646
of BioConductor, with more packages under development.
2662
of BioConductor, with more packages under development.
2647
 
2663
 
2648
*AnnBuilder*
2664
*AnnBuilder*
2649
     Assemble and process genomic annotation data, from databases such as
2665
     Assemble and process genomic annotation data, from databases such as
2650
     GenBank, the Gene Ontology Consortium, LocusLink, UniGene, the UCSC
2666
     GenBank, the Gene Ontology Consortium, LocusLink, UniGene, the UCSC
2651
     Human Genome Project.
2667
     Human Genome Project.
2652
 
2668
 
2653
*Biobase*
2669
*Biobase*
2654
     Object-oriented representation and manipulation of genomic data (S4
2670
     Object-oriented representation and manipulation of genomic data (S4
2655
     class structure).
2671
     class structure).
2656
 
2672
 
2657
*DynDoc*
2673
*DynDoc*
2658
     Functionality to create and interact with dynamic documents, vignettes,
2674
     Functionality to create and interact with dynamic documents, vignettes,
2659
     and other navigable documents.
2675
     and other navigable documents.
2660
 
2676
 
2661
*MAGEML*
2677
*MAGEML*
2662
     Functionality to handle MAGEML documents.
2678
     Functionality to handle MAGEML documents.
2663
 
2679
 
2664
*RBGL*
2680
*RBGL*
2665
     An interface between the graph package and the Boost graph libraries,
2681
     An interface between the graph package and the Boost graph libraries,
2666
     allowing for fast manipulation of graph objects in R.
2682
     allowing for fast manipulation of graph objects in R.
2667
 
2683
 
2668
*ROC*
2684
*ROC*
2669
     Receiver Operating Characteristic (ROC) approach for identifying genes
2685
     Receiver Operating Characteristic (ROC) approach for identifying genes
2670
     that are differentially expressed in two types of samples.
2686
     that are differentially expressed in two types of samples.
2671
 
2687
 
2672
*RdbiPgSQL*
2688
*RdbiPgSQL*
2673
     Methods for accessing data stored in PostgreSQL tables.
2689
     Methods for accessing data stored in PostgreSQL tables.
2674
 
2690
 
2675
*Rgraphviz*
2691
*Rgraphviz*
2676
     An interface with Graphviz for plotting graph objects in R.
2692
     An interface with Graphviz for plotting graph objects in R.
2677
 
2693
 
2678
*Ruuid*
2694
*Ruuid*
2679
     Creates Universally Unique ID values (UUIDs) in R.
2695
     Creates Universally Unique ID values (UUIDs) in R.
2680
 
2696
 
2681
*SAGElyzer*
2697
*SAGElyzer*
2682
     Locates genes based on SAGE tags.
2698
     Locates genes based on SAGE tags.
2683
 
2699
 
2684
*SNPtools*
2700
*SNPtools*
2685
     Rudimentary structures for SNP data.
2701
     Rudimentary structures for SNP data.
2686
 
2702
 
2687
*affy*
2703
*affy*
2688
     Methods for Affymetrix Oligonucleotide Arrays.
2704
     Methods for Affymetrix Oligonucleotide Arrays.
2689
 
2705
 
2690
*affyPLM*
2706
*affyPLM*
2691
     For fitting Probe Level Models.
2707
     For fitting Probe Level Models.
2692
 
2708
 
2693
*affycomp*
2709
*affycomp*
2694
     Graphics toolbox for assessment of Affymetrix expression measures.
2710
     Graphics toolbox for assessment of Affymetrix expression measures.
2695
 
2711
 
2696
*affydata*
2712
*affydata*
2697
     Affymetrix data for demonstration purposes.
2713
     Affymetrix data for demonstration purposes.
2698
 
2714
 
2699
*annaffy*
2715
*annaffy*
2700
     Functions for handling data from Bioconductor Affymetrix annotation
2716
     Functions for handling data from Bioconductor Affymetrix annotation
2701
     data packages.
2717
     data packages.
2702
 
2718
 
2703
*annotate*
2719
*annotate*
2704
     Associate experimental data in real time to biological metadata from
2720
     Associate experimental data in real time to biological metadata from
2705
     web databases such as GenBank, LocusLink and PubMed.  Process and store
2721
     web databases such as GenBank, LocusLink and PubMed.  Process and store
2706
     query results.  Generate HTML reports of analyses.
2722
     query results.  Generate HTML reports of analyses.
2707
 
2723
 
2708
*ctc*
2724
*ctc*
2709
     Tools to export and import Tree and Cluster to other programs.
2725
     Tools to export and import Tree and Cluster to other programs.
2710
 
2726
 
2711
*daMA*
2727
*daMA*
2712
     Functions for the efficient design of factorial two-color microarray
2728
     Functions for the efficient design of factorial two-color microarray
2713
     experiments and for the statistical analysis of factorial microarray
2729
     experiments and for the statistical analysis of factorial microarray
2714
     data.
2730
     data.
2715
 
2731
 
2716
*edd*
2732
*edd*
2717
     Expression density diagnostics: graphical methods and pattern
2733
     Expression density diagnostics: graphical methods and pattern
2718
     recognition algorithms for distribution shape classification.
2734
     recognition algorithms for distribution shape classification.
2719
 
2735
 
2720
*externalVector*
2736
*externalVector*
2721
     Basic class definitions and generics for external pointer based vector
2737
     Basic class definitions and generics for external pointer based vector
2722
     objects for R.
2738
     objects for R.
2723
 
2739
 
2724
*factDesign*
2740
*factDesign*
2725
     A set of tools for analyzing data from factorial designed micraorray
2741
     A set of tools for analyzing data from factorial designed micraorray
2726
     experiments.  The functions can be used to evaluate appropriate tests
2742
     experiments.  The functions can be used to evaluate appropriate tests
2727
     of contrast and perform single outlier detection.
2743
     of contrast and perform single outlier detection.
2728
 
2744
 
2729
*gcrma*
2745
*gcrma*
2730
     Background adjustment using sequence information.
2746
     Background adjustment using sequence information.
2731
 
2747
 
2732
*genefilter*
2748
*genefilter*
2733
     Tools for sequentially filtering genes using a wide variety of
2749
     Tools for sequentially filtering genes using a wide variety of
2734
     filtering functions.  Example of filters include: number of missing
2750
     filtering functions.  Example of filters include: number of missing
2735
     value, coefficient of variation of expression measures, ANOVA p-value,
2751
     value, coefficient of variation of expression measures, ANOVA p-value,
2736
     Cox model p-values.  Sequential application of filtering functions to
2752
     Cox model p-values.  Sequential application of filtering functions to
2737
     genes.
2753
     genes.
2738
 
2754
 
2739
*geneplotter*
2755
*geneplotter*
2740
     Graphical tools for genomic data, for example for plotting expression
2756
     Graphical tools for genomic data, for example for plotting expression
2741
     data along a chromosome or producing color images of expression data
2757
     data along a chromosome or producing color images of expression data
2742
     matrices.
2758
     matrices.
2743
 
2759
 
2744
*globaltest*
2760
*globaltest*
2745
     Testing globally whether a group of genes is significantly related to
2761
     Testing globally whether a group of genes is significantly related to
2746
     some clinical variable of interest.
2762
     some clinical variable of interest.
2747
 
2763
 
2748
*gpls*
2764
*gpls*
2749
     Classification using generalized partial least squares for two-group
2765
     Classification using generalized partial least squares for two-group
2750
     and multi-group classification.
2766
     and multi-group classification.
2751
 
2767
 
2752
*graph*
2768
*graph*
2753
     Classes and tools for creating and manipulating graphs within R.
2769
     Classes and tools for creating and manipulating graphs within R.
2754
 
2770
 
2755
*hexbin*
2771
*hexbin*
2756
     Binning functions, in particular hexagonal bins for graphing.
2772
     Binning functions, in particular hexagonal bins for graphing.
2757
 
2773
 
2758
*limma*
2774
*limma*
2759
     Linear models for microarray data.
2775
     Linear models for microarray data.
2760
 
2776
 
2761
*makecdfenv*
2777
*makecdfenv*
2762
     Two functions.  One reads a Affymetrix chip description file (CDF) and
2778
     Two functions.  One reads a Affymetrix chip description file (CDF) and
2763
     creates a hash table environment containing the location/probe set
2779
     creates a hash table environment containing the location/probe set
2764
     membership mapping.  The other creates a package that automatically
2780
     membership mapping.  The other creates a package that automatically
2765
     loads that environment.
2781
     loads that environment.
2766
 
2782
 
2767
*marrayClasses*
2783
*marrayClasses*
2768
     Class definitions for pre-normalized and normalized cDNA microarray
2784
     Class definitions for pre-normalized and normalized cDNA microarray
2769
     data.  Basic methods for accessing/replacing, printing, and subsetting.
2785
     data.  Basic methods for accessing/replacing, printing, and subsetting.
2770
 
2786
 
2771
*marrayInput*
2787
*marrayInput*
2772
     Functions for reading microarray data into R from different image
2788
     Functions for reading microarray data into R from different image
2773
     analysis output files, and probe and target description files.  Widgets
2789
     analysis output files, and probe and target description files.  Widgets
2774
     are supplied to facilitate and automate data input and the creation of
2790
     are supplied to facilitate and automate data input and the creation of
2775
     microarray specific R objects for storing these data.
2791
     microarray specific R objects for storing these data.
2776
 
2792
 
2777
*marrayNorm*
2793
*marrayNorm*
2778
     Functions for location and scale normalization procedures based on
2794
     Functions for location and scale normalization procedures based on
2779
     robust local regression.
2795
     robust local regression.
2780
 
2796
 
2781
*marrayPlots*
2797
*marrayPlots*
2782
     Functions for diagnostic plots for pre- and post-normalization cDNA
2798
     Functions for diagnostic plots for pre- and post-normalization cDNA
2783
     microarray intensity data: boxplots, scatter-plots, color images.
2799
     microarray intensity data: boxplots, scatter-plots, color images.
2784
 
2800
 
2785
*marrayTools*
2801
*marrayTools*
2786
     Miscellaneous functions used in the functional genomics core facility
2802
     Miscellaneous functions used in the functional genomics core facility
2787
     in UCB and UCSF.
2803
     in UCB and UCSF.
2788
 
2804
 
2789
*matchprobes*
2805
*matchprobes*
2790
     ools for sequence matching of probes on arrays.
2806
     ools for sequence matching of probes on arrays.
2791
 
2807
 
2792
*multtest*
2808
*multtest*
2793
     Multiple testing procedures for controlling the family-wise error rate
2809
     Multiple testing procedures for controlling the family-wise error rate
2794
     (FWER) and the false discovery rate (FDR).  Tests can be based on t-
2810
     (FWER) and the false discovery rate (FDR).  Tests can be based on t-
2795
     or F-statistics for one- and two-factor designs, and permutation
2811
     or F-statistics for one- and two-factor designs, and permutation
2796
     procedures are available to estimate adjusted p-values.
2812
     procedures are available to estimate adjusted p-values.
2797
 
2813
 
2798
*ontoTools*
2814
*ontoTools*
2799
     Graphs and sparse matrices for working with ontologies.
2815
     Graphs and sparse matrices for working with ontologies.
2800
 
2816
 
2801
*pamr*
2817
*pamr*
2802
     Pam: prediction analysis for microarrays.
2818
     Pam: prediction analysis for microarrays.
2803
 
2819
 
2804
*reposTools*
2820
*reposTools*
2805
     Tools for dealing with file repositories and allow users to easily
2821
     Tools for dealing with file repositories and allow users to easily
2806
     install, update, and distribute packages, vignettes, and other files.
2822
     install, update, and distribute packages, vignettes, and other files.
2807
 
2823
 
2808
*rhdf5*
2824
*rhdf5*
2809
     Storage and retrieval of large datasets using the HDF5 library and file
2825
     Storage and retrieval of large datasets using the HDF5 library and file
2810
     format.
2826
     format.
2811
 
2827
 
2812
*siggenes*
2828
*siggenes*
2813
     Identifying differentially expressed genes and estimating the False
2829
     Identifying differentially expressed genes and estimating the False
2814
     Discovery Rate (FDR) with both the Significance Analysis of Microarrays
2830
     Discovery Rate (FDR) with both the Significance Analysis of Microarrays
2815
     (SAM) and the Empirical Bayes Analyses of Microarrays (EBAM).
2831
     (SAM) and the Empirical Bayes Analyses of Microarrays (EBAM).
2816
 
2832
 
2817
*splicegear*
2833
*splicegear*
2818
     A set of tools to work with alternative splicing.
2834
     A set of tools to work with alternative splicing.
2819
 
2835
 
2820
*tkWidgets*
2836
*tkWidgets*
2821
     Widgets in Tcl/Tk that provide functionality for Bioconductor packages.
2837
     Widgets in Tcl/Tk that provide functionality for Bioconductor packages.
2822
 
2838
 
2823
*vsn*
2839
*vsn*
2824
     Calibration and variance stabilizing transformations for both
2840
     Calibration and variance stabilizing transformations for both
2825
     Affymetrix and cDNA array data.
2841
     Affymetrix and cDNA array data.
2826
 
2842
 
2827
*widgetTools*
2843
*widgetTools*
2828
     Tools for creating Tcl/Tk widgets, i.e., small-scale graphical user
2844
     Tools for creating Tcl/Tk widgets, i.e., small-scale graphical user
2829
     interfaces.
2845
     interfaces.
2830
 
2846
 
2831
5.1.5 Other add-on packages
2847
5.1.5 Other add-on packages
2832
---------------------------
2848
---------------------------
2833
 
2849
 
2834
Jim Lindsey <jlindsey@luc.ac.be> has written a collection of R packages for
2850
Jim Lindsey <jlindsey@luc.ac.be> has written a collection of R packages for
2835
nonlinear regression and repeated measurements, consisting of *event*
2851
nonlinear regression and repeated measurements, consisting of *event*
2836
(event history procedures and models), *gnlm* (generalized nonlinear
2852
(event history procedures and models), *gnlm* (generalized nonlinear
2837
regression models), *growth* (multivariate normal and
2853
regression models), *growth* (multivariate normal and
2838
elliptically-contoured repeated measurements models), *repeated*
2854
elliptically-contoured repeated measurements models), *repeated*
2839
(non-normal repeated measurements models), *rmutil* (utilities for
2855
(non-normal repeated measurements models), *rmutil* (utilities for
2840
nonlinear regression and repeated measurements), and *stable* (probability
2856
nonlinear regression and repeated measurements), and *stable* (probability
2841
functions and generalized regression models for stable distributions).  All
2857
functions and generalized regression models for stable distributions).  All
2842
analyses in the new edition of his book "Models for Repeated Measurements"
2858
analyses in the new edition of his book "Models for Repeated Measurements"
2843
(1999, Oxford University Press) were carried out using these packages.  Jim
2859
(1999, Oxford University Press) were carried out using these packages.  Jim
2844
has also started *dna*, a package with procedures for the analysis of DNA
2860
has also started *dna*, a package with procedures for the analysis of DNA
2845
sequences.  Jim's packages can be obtained from
2861
sequences.  Jim's packages can be obtained from
2846
`http://www.luc.ac.be/~jlindsey/rcode.html'.
2862
`http://www.luc.ac.be/~jlindsey/rcode.html'.
2847
 
2863
 
2848
   More code has been posted to the R-help mailing list, and can be
2864
   More code has been posted to the R-help mailing list, and can be
2849
obtained from the mailing list archive.
2865
obtained from the mailing list archive.
2850
 
2866
 
2851
5.2 How can add-on packages be installed?
2867
5.2 How can add-on packages be installed?
2852
=========================================
2868
=========================================
2853
 
2869
 
2854
(Unix only.)  The add-on packages on CRAN come as gzipped tar files named
2870
(Unix only.)  The add-on packages on CRAN come as gzipped tar files named
2855
`PKG_VERSION.tar.gz', which may in fact be "bundles" containing more than
2871
`PKG_VERSION.tar.gz', which may in fact be "bundles" containing more than
2856
one package.  Provided that `tar' and `gzip' are available on your system,
2872
one package.  Provided that `tar' and `gzip' are available on your system,
2857
type
2873
type
2858
 
2874
 
2859
     $ R CMD INSTALL /path/to/PKG_VERSION.tar.gz
2875
     $ R CMD INSTALL /path/to/PKG_VERSION.tar.gz
2860
 
2876
 
2861
at the shell prompt to install to the library tree rooted at the first
2877
at the shell prompt to install to the library tree rooted at the first
2862
directory given in `R_LIBS' (see below) if this is set and non-null, and to
2878
directory given in `R_LIBS' (see below) if this is set and non-null, and to
2863
the default library (the `library' subdirectory of ``R_HOME'') otherwise.
2879
the default library (the `library' subdirectory of ``R_HOME'') otherwise.
2864
(Versions of R prior to 1.3.0 installed to the default library by default.)
2880
(Versions of R prior to 1.3.0 installed to the default library by default.)
2865
 
2881
 
2866
   To install to another tree (e.g., your private one), use
2882
   To install to another tree (e.g., your private one), use
2867
 
2883
 
2868
     $ R CMD INSTALL -l LIB /path/to/PKG_VERSION.tar.gz
2884
     $ R CMD INSTALL -l LIB /path/to/PKG_VERSION.tar.gz
2869
 
2885
 
2870
where LIB gives the path to the library tree to install to.
2886
where LIB gives the path to the library tree to install to.
2871
 
2887
 
2872
   Even more conveniently, you can install and automatically update
2888
   Even more conveniently, you can install and automatically update
2873
packages from within R if you have access to CRAN.  See the help page for
2889
packages from within R if you have access to CRAN.  See the help page for
2874
`CRAN.packages()' for more information.
2890
`CRAN.packages()' for more information.
2875
 
2891
 
2876
   You can use several library trees of add-on packages.  The easiest way
2892
   You can use several library trees of add-on packages.  The easiest way
2877
to tell R to use these is via the environment variable `R_LIBS' which
2893
to tell R to use these is via the environment variable `R_LIBS' which
2878
should be a colon-separated list of directories at which R library trees
2894
should be a colon-separated list of directories at which R library trees
2879
are rooted.  You do not have to specify the default tree in `R_LIBS'.
2895
are rooted.  You do not have to specify the default tree in `R_LIBS'.
2880
E.g., to use a private tree in `$HOME/lib/R' and a public site-wide tree in
2896
E.g., to use a private tree in `$HOME/lib/R' and a public site-wide tree in
2881
`/usr/local/lib/R-contrib', put
2897
`/usr/local/lib/R-contrib', put
2882
 
2898
 
2883
     R_LIBS="$HOME/lib/R:/usr/local/lib/R-contrib"; export R_LIBS
2899
     R_LIBS="$HOME/lib/R:/usr/local/lib/R-contrib"; export R_LIBS
2884
 
2900
 
2885
into your (Bourne) shell profile or even preferably, add the line
2901
into your (Bourne) shell profile or even preferably, add the line
2886
 
2902
 
2887
     R_LIBS="$HOME/lib/R:/usr/local/lib/R-contrib"
2903
     R_LIBS="$HOME/lib/R:/usr/local/lib/R-contrib"
2888
 
2904
 
2889
your `~/.Renviron' file.  (Note that no `export' statement is needed or
2905
your `~/.Renviron' file.  (Note that no `export' statement is needed or
2890
allowed in this file; see the on-line help for `Startup' for more
2906
allowed in this file; see the on-line help for `Startup' for more
2891
information.)
2907
information.)
2892
 
2908
 
2893
5.3 How can add-on packages be used?
2909
5.3 How can add-on packages be used?
2894
====================================
2910
====================================
2895
 
2911
 
2896
To find out which additional packages are available on your system, type
2912
To find out which additional packages are available on your system, type
2897
 
2913
 
2898
     library()
2914
     library()
2899
 
2915
 
2900
at the R prompt.
2916
at the R prompt.
2901
 
2917
 
2902
   This produces something like
2918
   This produces something like
2903
 
2919
 
2904
     Packages in `/home/me/lib/R':
2920
     Packages in `/home/me/lib/R':
2905
     
2921
     
2906
     mystuff       My own R functions, nicely packaged but not documented
2922
     mystuff       My own R functions, nicely packaged but not documented
2907
     
2923
     
2908
     Packages in `/usr/local/lib/R/library':
2924
     Packages in `/usr/local/lib/R/library':
2909
     
2925
     
2910
     KernSmooth    Functions for kernel smoothing for Wand & Jones (1995)
2926
     KernSmooth    Functions for kernel smoothing for Wand & Jones (1995)
2911
     MASS          Main Library of Venables and Ripley's MASS
2927
     MASS          Main Library of Venables and Ripley's MASS
2912
     base          The R base package
2928
     base          The R base package
2913
     boot          Bootstrap R (S-Plus) Functions (Canty)
2929
     boot          Bootstrap R (S-Plus) Functions (Canty)
2914
     class         Functions for classification
2930
     class         Functions for classification
2915
     cluster       Functions for clustering (by Rousseeuw et al.)
2931
     cluster       Functions for clustering (by Rousseeuw et al.)
2916
     ctest         Classical Tests
2932
     ctest         Classical Tests
2917
     eda           Exploratory Data Analysis
2933
     eda           Exploratory Data Analysis
2918
     foreign       Read data stored by Minitab, S, SAS, SPSS, Stata, ...
2934
     foreign       Read data stored by Minitab, S, SAS, SPSS, Stata, ...
2919
     grid          The Grid Graphics Package
2935
     grid          The Grid Graphics Package
2920
     lattice       Lattice Graphics
2936
     lattice       Lattice Graphics
2921
     lqs           Resistant Regression and Covariance Estimation
2937
     lqs           Resistant Regression and Covariance Estimation
2922
     methods       Formal Methods and Classes
2938
     methods       Formal Methods and Classes
2923
     mle           Maximum likelihood estimation
2939
     mle           Maximum likelihood estimation
2924
     mgcv          Multiple smoothing parameter estimation and GAMs by GCV
2940
     mgcv          Multiple smoothing parameter estimation and GAMs by GCV
2925
     modreg        Modern Regression: Smoothing and Local Methods
2941
     modreg        Modern Regression: Smoothing and Local Methods
2926
     mva           Classical Multivariate Analysis
2942
     mva           Classical Multivariate Analysis
2927
     nlme          Linear and nonlinear mixed effects models
2943
     nlme          Linear and nonlinear mixed effects models
2928
     nls           Nonlinear regression
2944
     nls           Nonlinear regression
2929
     nnet          Feed-forward neural networks and multinomial log-linear
2945
     nnet          Feed-forward neural networks and multinomial log-linear
2930
                   models
2946
                   models
2931
     rpart         Recursive partitioning
2947
     rpart         Recursive partitioning
2932
     spatial       functions for kriging and point pattern analysis
2948
     spatial       functions for kriging and point pattern analysis
2933
     splines       Regression Spline Functions and Classes
2949
     splines       Regression Spline Functions and Classes
2934
     stepfun       Step Functions, including Empirical Distributions
2950
     stepfun       Step Functions, including Empirical Distributions
2935
     survival      Survival analysis, including penalised likelihood
2951
     survival      Survival analysis, including penalised likelihood
2936
     tcltk         Tcl/Tk Interface
2952
     tcltk         Tcl/Tk Interface
2937
     tools         Tools for Package Development and Administration
2953
     tools         Tools for Package Development and Administration
2938
     ts            Time series functions
2954
     ts            Time series functions
2939
 
2955
 
2940
   You can "load" the installed package PKG by
2956
   You can "load" the installed package PKG by
2941
 
2957
 
2942
     library(PKG)
2958
     library(PKG)
2943
 
2959
 
2944
   You can then find out which functions it provides by typing one of
2960
   You can then find out which functions it provides by typing one of
2945
 
2961
 
2946
     library(help = PKG)
2962
     library(help = PKG)
2947
     help(package = PKG)
2963
     help(package = PKG)
2948
 
2964
 
2949
   You can unload the loaded package PKG by
2965
   You can unload the loaded package PKG by
2950
 
2966
 
2951
     detach("package:PKG")
2967
     detach("package:PKG")
2952
 
2968
 
2953
5.4 How can add-on packages be removed?
2969
5.4 How can add-on packages be removed?
2954
=======================================
2970
=======================================
2955
 
2971
 
2956
Use
2972
Use
2957
 
2973
 
2958
     $ R CMD REMOVE PKG_1 ... PKG_N
2974
     $ R CMD REMOVE PKG_1 ... PKG_N
2959
 
2975
 
2960
to remove the packages PKG_1, ..., PKG_N from the library tree rooted at
2976
to remove the packages PKG_1, ..., PKG_N from the library tree rooted at
2961
the first directory given in `R_LIBS' if this is set and non-null, and from
2977
the first directory given in `R_LIBS' if this is set and non-null, and from
2962
the default library otherwise.  (Versions of R prior to 1.3.0 removed from
2978
the default library otherwise.  (Versions of R prior to 1.3.0 removed from
2963
the default library by default.)
2979
the default library by default.)
2964
 
2980
 
2965
   To remove from library LIB, do
2981
   To remove from library LIB, do
2966
 
2982
 
2967
     $ R CMD REMOVE -l LIB PKG_1 ... PKG_N
2983
     $ R CMD REMOVE -l LIB PKG_1 ... PKG_N
2968
 
2984
 
2969
5.5 How can I create an R package?
2985
5.5 How can I create an R package?
2970
==================================
2986
==================================
2971
 
2987
 
2972
A package consists of a subdirectory containing the files `DESCRIPTION' and
2988
A package consists of a subdirectory containing the files `DESCRIPTION' and
2973
`INDEX', and the subdirectories `R', `data', `demo', `exec', `inst', `man',
2989
`INDEX', and the subdirectories `R', `data', `demo', `exec', `inst', `man',
2974
`src', and `tests' (some of which can be missing).  Optionally the package
2990
`src', and `tests' (some of which can be missing).  Optionally the package
2975
can also contain script files `configure' and `cleanup' which are executed
2991
can also contain script files `configure' and `cleanup' which are executed
2976
before and after installation.
2992
before and after installation.
2977
 
2993
 
2978
   See section "Creating R packages" in `Writing R Extensions', for details.
2994
   See section "Creating R packages" in `Writing R Extensions', for details.
2979
This manual is included in the R distribution, *note What documentation
2995
This manual is included in the R distribution, *note What documentation
2980
exists for R?::, and gives information on package structure, the configure
2996
exists for R?::, and gives information on package structure, the configure
2981
and cleanup mechanisms, and on automated package checking and building.
2997
and cleanup mechanisms, and on automated package checking and building.
2982
 
2998
 
2983
   R version 1.3.0 has added the function `package.skeleton()' which will
2999
   R version 1.3.0 has added the function `package.skeleton()' which will
2984
set up directories, save data and code, and create skeleton help files for
3000
set up directories, save data and code, and create skeleton help files for
2985
a set of R functions and datasets.
3001
a set of R functions and datasets.
2986
 
3002
 
2987
   *Note What is CRAN?::, for information on uploading a package to CRAN.
3003
   *Note What is CRAN?::, for information on uploading a package to CRAN.
2988
 
3004
 
2989
5.6 How can I contribute to R?
3005
5.6 How can I contribute to R?
2990
==============================
3006
==============================
2991
 
3007
 
2992
R is in active development and there is always a risk of bugs creeping in.
3008
R is in active development and there is always a risk of bugs creeping in.
2993
Also, the developers do not have access to all possible machines capable of
3009
Also, the developers do not have access to all possible machines capable of
2994
running R.  So, simply using it and communicating problems is certainly of
3010
running R.  So, simply using it and communicating problems is certainly of
2995
great value.
3011
great value.
2996
 
3012
 
2997
   One place where functionality is still missing is the modeling software
3013
   One place where functionality is still missing is the modeling software
2998
as described in "Statistical Models in S" (see *Note What is S?::);
3014
as described in "Statistical Models in S" (see *Note What is S?::);
2999
Generalized Additive Models (*note Are GAMs implemented in R?::) and some
3015
Generalized Additive Models (*note Are GAMs implemented in R?::) and some
3000
of the nonlinear modeling code are not there yet.
3016
of the nonlinear modeling code are not there yet.
3001
 
3017
 
3002
   The R Developer Page (http://developer.R-project.org/) acts as an
3018
   The R Developer Page (http://developer.R-project.org/) acts as an
3003
intermediate repository for more or less finalized ideas and plans for the
3019
intermediate repository for more or less finalized ideas and plans for the
3004
R statistical system.  It contains (pointers to) TODO lists, RFCs, various
3020
R statistical system.  It contains (pointers to) TODO lists, RFCs, various
3005
other writeups, ideas lists, and CVS miscellanea.
3021
other writeups, ideas lists, and CVS miscellanea.
3006
 
3022
 
3007
   Many (more) of the packages available at the Statlib S Repository might
3023
   Many (more) of the packages available at the Statlib S Repository might
3008
be worth porting to R.
3024
be worth porting to R.
3009
 
3025
 
3010
   If you are interested in working on any of these projects, please notify
3026
   If you are interested in working on any of these projects, please notify
3011
Kurt Hornik <Kurt.Hornik@R-project.org>.
3027
Kurt Hornik <Kurt.Hornik@R-project.org>.
3012
 
3028
 
3013
6 R and Emacs
3029
6 R and Emacs
3014
*************
3030
*************
3015
 
3031
 
3016
6.1 Is there Emacs support for R?
3032
6.1 Is there Emacs support for R?
3017
=================================
3033
=================================
3018
 
3034
 
3019
There is an Emacs package called ESS ("Emacs Speaks Statistics") which
3035
There is an Emacs package called ESS ("Emacs Speaks Statistics") which
3020
provides a standard interface between statistical programs and statistical
3036
provides a standard interface between statistical programs and statistical
3021
processes.  It is intended to provide assistance for interactive
3037
processes.  It is intended to provide assistance for interactive
3022
statistical programming and data analysis.  Languages supported include: S
3038
statistical programming and data analysis.  Languages supported include: S
3023
dialects (S 3/4, S-PLUS 3.x/4.x/5.x, and R), LispStat dialects (XLispStat,
3039
dialects (S 3/4, S-PLUS 3.x/4.x/5.x, and R), LispStat dialects (XLispStat,
3024
ViSta) and SAS.  Stata and SPSS dialect (SPSS, PSPP) support is being
3040
ViSta) and SAS.  Stata and SPSS dialect (SPSS, PSPP) support is being
3025
examined for possible future implementation
3041
examined for possible future implementation
3026
 
3042
 
3027
   ESS grew out of the need for bug fixes and extensions to S-mode 4.8
3043
   ESS grew out of the need for bug fixes and extensions to S-mode 4.8
3028
(which was a GNU Emacs interface to S/S-PLUS version 3 only).  The current
3044
(which was a GNU Emacs interface to S/S-PLUS version 3 only).  The current
3029
set of developers desired support for XEmacs, R, S4, and MS Windows.  In
3045
set of developers desired support for XEmacs, R, S4, and MS Windows.  In
3030
addition, with new modes being developed for R, Stata, and SAS, it was felt
3046
addition, with new modes being developed for R, Stata, and SAS, it was felt
3031
that a unifying interface and framework for the user interface would
3047
that a unifying interface and framework for the user interface would
3032
benefit both the user and the developer, by helping both groups conform to
3048
benefit both the user and the developer, by helping both groups conform to
3033
standard Emacs usage.  The end result is an increase in efficiency for
3049
standard Emacs usage.  The end result is an increase in efficiency for
3034
statistical programming and data analysis, over the usual tools.
3050
statistical programming and data analysis, over the usual tools.
3035
 
3051
 
3036
   R support contains code for editing R source code (syntactic indentation
3052
   R support contains code for editing R source code (syntactic indentation
3037
and highlighting of source code, partial evaluations of code, loading and
3053
and highlighting of source code, partial evaluations of code, loading and
3038
error-checking of code, and source code revision maintenance) and
3054
error-checking of code, and source code revision maintenance) and
3039
documentation (syntactic indentation and highlighting of source code,
3055
documentation (syntactic indentation and highlighting of source code,
3040
sending examples to running ESS process, and previewing), interacting with
3056
sending examples to running ESS process, and previewing), interacting with
3041
an inferior R process from within Emacs (command-line editing, searchable
3057
an inferior R process from within Emacs (command-line editing, searchable
3042
command history, command-line completion of R object and file names, quick
3058
command history, command-line completion of R object and file names, quick
3043
access to object and search lists, transcript recording, and an interface
3059
access to object and search lists, transcript recording, and an interface
3044
to the help system), and transcript manipulation (recording and saving
3060
to the help system), and transcript manipulation (recording and saving
3045
transcript files, manipulating and editing saved transcripts, and
3061
transcript files, manipulating and editing saved transcripts, and
3046
re-evaluating commands from transcript files).
3062
re-evaluating commands from transcript files).
3047
 
3063
 
3048
   The latest stable version of ESS are available via CRAN or the ESS web
3064
   The latest stable version of ESS are available via CRAN or the ESS web
3049
page (http://ESS.R-project.org/).  The HTML version of the documentation
3065
page (http://ESS.R-project.org/).  The HTML version of the documentation
3050
can be found at `http://stat.ethz.ch/ESS/'.
3066
can be found at `http://stat.ethz.ch/ESS/'.
3051
 
3067
 
3052
   ESS comes with detailed installation instructions.
3068
   ESS comes with detailed installation instructions.
3053
 
3069
 
3054
   For help with ESS, send email to <ESS-help@stat.ethz.ch>.
3070
   For help with ESS, send email to <ESS-help@stat.ethz.ch>.
3055
 
3071
 
3056
   Please send bug reports and suggestions on ESS to
3072
   Please send bug reports and suggestions on ESS to
3057
<ESS-bugs@stat.math.ethz.ch>.  The easiest way to do this from is within
3073
<ESS-bugs@stat.math.ethz.ch>.  The easiest way to do this from is within
3058
Emacs by typing `M-x ess-submit-bug-report' or using the [ESS] or [iESS]
3074
Emacs by typing `M-x ess-submit-bug-report' or using the [ESS] or [iESS]
3059
pulldown menus.
3075
pulldown menus.
3060
 
3076
 
3061
6.2 Should I run R from within Emacs?
3077
6.2 Should I run R from within Emacs?
3062
=====================================
3078
=====================================
3063
 
3079
 
3064
Yes, _definitely_.  Inferior R mode provides a readline/history mechanism,
3080
Yes, _definitely_.  Inferior R mode provides a readline/history mechanism,
3065
object name completion, and syntax-based highlighting of the interaction
3081
object name completion, and syntax-based highlighting of the interaction
3066
buffer using Font Lock mode, as well as a very convenient interface to the
3082
buffer using Font Lock mode, as well as a very convenient interface to the
3067
R help system.
3083
R help system.
3068
 
3084
 
3069
   Of course, it also integrates nicely with the mechanisms for editing R
3085
   Of course, it also integrates nicely with the mechanisms for editing R
3070
source using Emacs.  One can write code in one Emacs buffer and send whole
3086
source using Emacs.  One can write code in one Emacs buffer and send whole
3071
or parts of it for execution to R; this is helpful for both data analysis
3087
or parts of it for execution to R; this is helpful for both data analysis
3072
and programming.  One can also seamlessly integrate with a revision control
3088
and programming.  One can also seamlessly integrate with a revision control
3073
system, in order to maintain a log of changes in your programs and data, as
3089
system, in order to maintain a log of changes in your programs and data, as
3074
well as to allow for the retrieval of past versions of the code.
3090
well as to allow for the retrieval of past versions of the code.
3075
 
3091
 
3076
   In addition, it allows you to keep a record of your session, which can
3092
   In addition, it allows you to keep a record of your session, which can
3077
also be used for error recovery through the use of the transcript mode.
3093
also be used for error recovery through the use of the transcript mode.
3078
 
3094
 
3079
   To specify command line arguments for the inferior R process, use `C-u
3095
   To specify command line arguments for the inferior R process, use `C-u
3080
M-x R' for starting R.
3096
M-x R' for starting R.
3081
 
3097
 
3082
6.3 Debugging R from within Emacs
3098
6.3 Debugging R from within Emacs
3083
=================================
3099
=================================
3084
 
3100
 
3085
To debug R "from within Emacs", there are several possibilities.  To use
3101
To debug R "from within Emacs", there are several possibilities.  To use
3086
the Emacs GUD (Grand Unified Debugger) library with the recommended
3102
the Emacs GUD (Grand Unified Debugger) library with the recommended
3087
debugger GDB, type `M-x gdb' and give the path to the R _binary_ as
3103
debugger GDB, type `M-x gdb' and give the path to the R _binary_ as
3088
argument.  At the `gdb' prompt, set `R_HOME' and other environment
3104
argument.  At the `gdb' prompt, set `R_HOME' and other environment
3089
variables as needed (using e.g.  `set env R_HOME /path/to/R/', but see also
3105
variables as needed (using e.g.  `set env R_HOME /path/to/R/', but see also
3090
below), and start the binary with the desired arguments (e.g., `run
3106
below), and start the binary with the desired arguments (e.g., `run
3091
--quiet').
3107
--quiet').
3092
 
3108
 
3093
   If you have ESS, you can do `C-u M-x R <RET> - d <SPC> g d b <RET>' to
3109
   If you have ESS, you can do `C-u M-x R <RET> - d <SPC> g d b <RET>' to
3094
start an inferior R process with arguments `-d gdb'.
3110
start an inferior R process with arguments `-d gdb'.
3095
 
3111
 
3096
   A third option is to start an inferior R process via ESS (`M-x R') and
3112
   A third option is to start an inferior R process via ESS (`M-x R') and
3097
then start GUD (`M-x gdb') giving the R binary (using its full path name)
3113
then start GUD (`M-x gdb') giving the R binary (using its full path name)
3098
as the program to debug.  Use the program `ps' to find the process number
3114
as the program to debug.  Use the program `ps' to find the process number
3099
of the currently running R process then use the `attach' command in gdb to
3115
of the currently running R process then use the `attach' command in gdb to
3100
attach it to that process.  One advantage of this method is that you have
3116
attach it to that process.  One advantage of this method is that you have
3101
separate `*R*' and `*gud-gdb*' windows.  Within the `*R*' window you have
3117
separate `*R*' and `*gud-gdb*' windows.  Within the `*R*' window you have
3102
all the ESS facilities, such as object-name completion, that we know and
3118
all the ESS facilities, such as object-name completion, that we know and
3103
love.
3119
love.
3104
 
3120
 
3105
   When using GUD mode for debugging from within Emacs, you may find it
3121
   When using GUD mode for debugging from within Emacs, you may find it
3106
most convenient to use the directory with your code in it as the current
3122
most convenient to use the directory with your code in it as the current
3107
working directory and then make a symbolic link from that directory to the
3123
working directory and then make a symbolic link from that directory to the
3108
R binary.  That way `.gdbinit' can stay in the directory with the code and
3124
R binary.  That way `.gdbinit' can stay in the directory with the code and
3109
be used to set up the environment and the search paths for the source, e.g.
3125
be used to set up the environment and the search paths for the source, e.g.
3110
as follows:
3126
as follows:
3111
 
3127
 
3112
     set env R_HOME /opt/R
3128
     set env R_HOME /opt/R
3113
     set env R_PAPERSIZE letter
3129
     set env R_PAPERSIZE letter
3114
     set env R_PRINTCMD lpr
3130
     set env R_PRINTCMD lpr
3115
     dir /opt/R/src/appl
3131
     dir /opt/R/src/appl
3116
     dir /opt/R/src/main
3132
     dir /opt/R/src/main
3117
     dir /opt/R/src/nmath
3133
     dir /opt/R/src/nmath
3118
     dir /opt/R/src/unix
3134
     dir /opt/R/src/unix
3119
 
3135
 
3120
7 R Miscellanea
3136
7 R Miscellanea
3121
***************
3137
***************
3122
 
3138
 
3123
7.1 Why does R run out of memory?
3139
7.1 Why does R run out of memory?
3124
=================================
3140
=================================
3125
 
3141
 
3126
Versions of R prior to 1.2.0 used a _static_ memory model.  At startup, R
3142
Versions of R prior to 1.2.0 used a _static_ memory model.  At startup, R
3127
asked the operating system to reserve a fixed amount of memory for it.  The
3143
asked the operating system to reserve a fixed amount of memory for it.  The
3128
size of this chunk could not be changed subsequently.  Hence, it could
3144
size of this chunk could not be changed subsequently.  Hence, it could
3129
happen that not enough memory was allocated, e.g., when trying to read
3145
happen that not enough memory was allocated, e.g., when trying to read
3130
large data sets into R.  In such cases, it was necessary to restart R with
3146
large data sets into R.  In such cases, it was necessary to restart R with
3131
more memory available, as controlled by the command line options `--nsize'
3147
more memory available, as controlled by the command line options `--nsize'
3132
and `--vsize'.
3148
and `--vsize'.
3133
 
3149
 
3134
   R version 1.2.0 introduces a new "generational" garbage collector, which
3150
   R version 1.2.0 introduces a new "generational" garbage collector, which
3135
will increase the memory available to R as needed.  Hence, user
3151
will increase the memory available to R as needed.  Hence, user
3136
intervention is no longer necessary for ensuring that enough memory is
3152
intervention is no longer necessary for ensuring that enough memory is
3137
available.
3153
available.
3138
 
3154
 
3139
   The new garbage collector does not move objects in memory, meaning that
3155
   The new garbage collector does not move objects in memory, meaning that
3140
it is possible for the free memory to become fragmented so that large
3156
it is possible for the free memory to become fragmented so that large
3141
objects cannot be allocated even when there is apparently enough memory for
3157
objects cannot be allocated even when there is apparently enough memory for
3142
them.
3158
them.
3143
 
3159
 
3144
7.2 Why does sourcing a correct file fail?
3160
7.2 Why does sourcing a correct file fail?
3145
==========================================
3161
==========================================
3146
 
3162
 
3147
Versions of R prior to 1.2.1 may have had problems parsing files not ending
3163
Versions of R prior to 1.2.1 may have had problems parsing files not ending
3148
in a newline.  Earlier R versions had a similar problem when reading in
3164
in a newline.  Earlier R versions had a similar problem when reading in
3149
data files.  This should no longer happen.
3165
data files.  This should no longer happen.
3150
 
3166
 
3151
7.3 How can I set components of a list to NULL?
3167
7.3 How can I set components of a list to NULL?
3152
===============================================
3168
===============================================
3153
 
3169
 
3154
You can use
3170
You can use
3155
 
3171
 
3156
     x[i] <- list(NULL)
3172
     x[i] <- list(NULL)
3157
 
3173
 
3158
to set component `i' of the list `x' to `NULL', similarly for named
3174
to set component `i' of the list `x' to `NULL', similarly for named
3159
components.  Do not set `x[i]' or `x[[i]]' to `NULL', because this will
3175
components.  Do not set `x[i]' or `x[[i]]' to `NULL', because this will
3160
remove the corresponding component from the list.
3176
remove the corresponding component from the list.
3161
 
3177
 
3162
   For dropping the row names of a matrix `x', it may be easier to use
3178
   For dropping the row names of a matrix `x', it may be easier to use
3163
`rownames(x) <- NULL', similarly for column names.
3179
`rownames(x) <- NULL', similarly for column names.
3164
 
3180
 
3165
7.4 How can I save my workspace?
3181
7.4 How can I save my workspace?
3166
================================
3182
================================
3167
 
3183
 
3168
`save.image()' saves the objects in the user's `.GlobalEnv' to the file
3184
`save.image()' saves the objects in the user's `.GlobalEnv' to the file
3169
`.RData' in the R startup directory.  (This is also what happens after
3185
`.RData' in the R startup directory.  (This is also what happens after
3170
`q("yes")'.)  Using `save.image(FILE)' one can save the image under a
3186
`q("yes")'.)  Using `save.image(FILE)' one can save the image under a
3171
different name.
3187
different name.
3172
 
3188
 
3173
7.5 How can I clean up my workspace?
3189
7.5 How can I clean up my workspace?
3174
====================================
3190
====================================
3175
 
3191
 
3176
To remove all objects in the currently active environment (typically
3192
To remove all objects in the currently active environment (typically
3177
`.GlobalEnv'), you can do
3193
`.GlobalEnv'), you can do
3178
 
3194
 
3179
     rm(list = ls(all = TRUE))
3195
     rm(list = ls(all = TRUE))
3180
 
3196
 
3181
(Without `all = TRUE', only the objects with names not starting with a `.'
3197
(Without `all = TRUE', only the objects with names not starting with a `.'
3182
are removed.)
3198
are removed.)
3183
 
3199
 
3184
7.6 How can I get eval() and D() to work?
3200
7.6 How can I get eval() and D() to work?
3185
=========================================
3201
=========================================
3186
 
3202
 
3187
Strange things will happen if you use `eval(print(x), envir = e)' or
3203
Strange things will happen if you use `eval(print(x), envir = e)' or
3188
`D(x^2, "x")'.  The first one will either tell you that "`x'" is not found,
3204
`D(x^2, "x")'.  The first one will either tell you that "`x'" is not found,
3189
or print the value of the wrong `x'.  The other one will likely return zero
3205
or print the value of the wrong `x'.  The other one will likely return zero
3190
if `x' exists, and an error otherwise.
3206
if `x' exists, and an error otherwise.
3191
 
3207
 
3192
   This is because in both cases, the first argument is evaluated in the
3208
   This is because in both cases, the first argument is evaluated in the
3193
calling environment first.  The result (which should be an object of mode
3209
calling environment first.  The result (which should be an object of mode
3194
`"expression"' or `"call"') is then evaluated or differentiated.  What you
3210
`"expression"' or `"call"') is then evaluated or differentiated.  What you
3195
(most likely) really want is obtained by "quoting" the first argument upon
3211
(most likely) really want is obtained by "quoting" the first argument upon
3196
surrounding it with `expression()'.  For example,
3212
surrounding it with `expression()'.  For example,
3197
 
3213
 
3198
     R> D(expression(x^2), "x")
3214
     R> D(expression(x^2), "x")
3199
     2 * x
3215
     2 * x
3200
 
3216
 
3201
   Although this behavior may initially seem to be rather strange, is
3217
   Although this behavior may initially seem to be rather strange, is
3202
perfectly logical.  The "intuitive" behavior could easily be implemented,
3218
perfectly logical.  The "intuitive" behavior could easily be implemented,
3203
but problems would arise whenever the expression is contained in a
3219
but problems would arise whenever the expression is contained in a
3204
variable, passed as a parameter, or is the result of a function call.
3220
variable, passed as a parameter, or is the result of a function call.
3205
Consider for instance the semantics in cases like
3221
Consider for instance the semantics in cases like
3206
 
3222
 
3207
     D2 <- function(e, n) D(D(e, n), n)
3223
     D2 <- function(e, n) D(D(e, n), n)
3208
 
3224
 
3209
or
3225
or
3210
 
3226
 
3211
     g <- function(y) eval(substitute(y), sys.frame(sys.parent(n = 2)))
3227
     g <- function(y) eval(substitute(y), sys.frame(sys.parent(n = 2)))
3212
     g(a * b)
3228
     g(a * b)
3213
 
3229
 
3214
   See the help page for `deriv()' for more examples.
3230
   See the help page for `deriv()' for more examples.
3215
 
3231
 
3216
7.7 Why do my matrices lose dimensions?
3232
7.7 Why do my matrices lose dimensions?
3217
=======================================
3233
=======================================
3218
 
3234
 
3219
When a matrix with a single row or column is created by a subscripting
3235
When a matrix with a single row or column is created by a subscripting
3220
operation, e.g., `row <- mat[2, ]', it is by default turned into a vector.
3236
operation, e.g., `row <- mat[2, ]', it is by default turned into a vector.
3221
In a similar way if an array with dimension, say, 2 x 3 x 1 x 4 is created
3237
In a similar way if an array with dimension, say, 2 x 3 x 1 x 4 is created
3222
by subscripting it will be coerced into a 2 x 3 x 4 array, losing the
3238
by subscripting it will be coerced into a 2 x 3 x 4 array, losing the
3223
unnecessary dimension.  After much discussion this has been determined to
3239
unnecessary dimension.  After much discussion this has been determined to
3224
be a _feature_.
3240
be a _feature_.
3225
 
3241
 
3226
   To prevent this happening, add the option `drop = FALSE' to the
3242
   To prevent this happening, add the option `drop = FALSE' to the
3227
subscripting.  For example,
3243
subscripting.  For example,
3228
 
3244
 
3229
     rowmatrix <- mat[2, , drop = FALSE]  # creates a row matrix
3245
     rowmatrix <- mat[2, , drop = FALSE]  # creates a row matrix
3230
     colmatrix <- mat[, 2, drop = FALSE]  # creates a column matrix
3246
     colmatrix <- mat[, 2, drop = FALSE]  # creates a column matrix
3231
     a <- b[1, 1, 1, drop = FALSE]        # creates a 1 x 1 x 1 array
3247
     a <- b[1, 1, 1, drop = FALSE]        # creates a 1 x 1 x 1 array
3232
 
3248
 
3233
   The `drop = FALSE' option should be used defensively when programming.
3249
   The `drop = FALSE' option should be used defensively when programming.
3234
For example, the statement
3250
For example, the statement
3235
 
3251
 
3236
     somerows <- mat[index, ]
3252
     somerows <- mat[index, ]
3237
 
3253
 
3238
will return a vector rather than a matrix if `index' happens to have length
3254
will return a vector rather than a matrix if `index' happens to have length
3239
1, causing errors later in the code.  It should probably be rewritten as
3255
1, causing errors later in the code.  It should probably be rewritten as
3240
 
3256
 
3241
     somerows <- mat[index, , drop = FALSE]
3257
     somerows <- mat[index, , drop = FALSE]
3242
 
3258
 
3243
7.8 How does autoloading work?
3259
7.8 How does autoloading work?
3244
==============================
3260
==============================
3245
 
3261
 
3246
R has a special environment called `.AutoloadEnv'.  Using `autoload(NAME,
3262
R has a special environment called `.AutoloadEnv'.  Using `autoload(NAME,
3247
PKG)', where NAME and PKG are strings giving the names of an object and the
3263
PKG)', where NAME and PKG are strings giving the names of an object and the
3248
package containing it, stores some information in this environment.  When R
3264
package containing it, stores some information in this environment.  When R
3249
tries to evaluate NAME, it loads the corresponding package PKG and
3265
tries to evaluate NAME, it loads the corresponding package PKG and
3250
reevaluates NAME in the new package's environment.
3266
reevaluates NAME in the new package's environment.
3251
 
3267
 
3252
   Using this mechanism makes R behave as if the package was loaded, but
3268
   Using this mechanism makes R behave as if the package was loaded, but
3253
does not occupy memory (yet).
3269
does not occupy memory (yet).
3254
 
3270
 
3255
   See the help page for `autoload()' for a very nice example.
3271
   See the help page for `autoload()' for a very nice example.
3256
 
3272
 
3257
7.9 How should I set options?
3273
7.9 How should I set options?
3258
=============================
3274
=============================
3259
 
3275
 
3260
The function `options()' allows setting and examining a variety of global
3276
The function `options()' allows setting and examining a variety of global
3261
"options" which affect the way in which R computes and displays its
3277
"options" which affect the way in which R computes and displays its
3262
results.  The variable `.Options' holds the current values of these
3278
results.  The variable `.Options' holds the current values of these
3263
options, but should never directly be assigned to unless you want to drive
3279
options, but should never directly be assigned to unless you want to drive
3264
yourself crazy--simply pretend that it is a "read-only" variable.
3280
yourself crazy--simply pretend that it is a "read-only" variable.
3265
 
3281
 
3266
   For example, given
3282
   For example, given
3267
 
3283
 
3268
     test1 <- function(x = pi, dig = 3) {
3284
     test1 <- function(x = pi, dig = 3) {
3269
       oo <- options(digits = dig); on.exit(options(oo));
3285
       oo <- options(digits = dig); on.exit(options(oo));
3270
       cat(.Options$digits, x, "\n")
3286
       cat(.Options$digits, x, "\n")
3271
     }
3287
     }
3272
     test2 <- function(x = pi, dig = 3) {
3288
     test2 <- function(x = pi, dig = 3) {
3273
       .Options$digits <- dig
3289
       .Options$digits <- dig
3274
       cat(.Options$digits, x, "\n")
3290
       cat(.Options$digits, x, "\n")
3275
     }
3291
     }
3276
 
3292
 
3277
we obtain:
3293
we obtain:
3278
 
3294
 
3279
     R> test1()
3295
     R> test1()
3280
     3 3.14
3296
     3 3.14
3281
     R> test2()
3297
     R> test2()
3282
     3 3.141593
3298
     3 3.141593
3283
 
3299
 
3284
   What is really used is the _global_ value of `.Options', and using
3300
   What is really used is the _global_ value of `.Options', and using
3285
`options(OPT = VAL)' correctly updates it.  Local copies of `.Options',
3301
`options(OPT = VAL)' correctly updates it.  Local copies of `.Options',
3286
either in `.GlobalEnv' or in a function environment (frame), are just
3302
either in `.GlobalEnv' or in a function environment (frame), are just
3287
silently disregarded.
3303
silently disregarded.
3288
 
3304
 
3289
7.10 How do file names work in Windows?
3305
7.10 How do file names work in Windows?
3290
=======================================
3306
=======================================
3291
 
3307
 
3292
As R uses C-style string handling, `\' is treated as an escape character,
3308
As R uses C-style string handling, `\' is treated as an escape character,
3293
so that for example one can enter a newline as `\n'.  When you really need
3309
so that for example one can enter a newline as `\n'.  When you really need
3294
a `\', you have to escape it with another `\'.
3310
a `\', you have to escape it with another `\'.
3295
 
3311
 
3296
   Thus, in filenames use something like `"c:\\data\\money.dat"'.  You can
3312
   Thus, in filenames use something like `"c:\\data\\money.dat"'.  You can
3297
also replace `\' by `/' (`"c:/data/money.dat"').
3313
also replace `\' by `/' (`"c:/data/money.dat"').
3298
 
3314
 
3299
7.11 Why does plotting give a color allocation error?
3315
7.11 Why does plotting give a color allocation error?
3300
=====================================================
3316
=====================================================
3301
 
3317
 
3302
Sometimes plotting, e.g., when running `demo("image")', results in "Error:
3318
Sometimes plotting, e.g., when running `demo("image")', results in "Error:
3303
color allocation error".  This is an X problem, and only indirectly related
3319
color allocation error".  This is an X problem, and only indirectly related
3304
to R.  It occurs when applications started prior to R have used all the
3320
to R.  It occurs when applications started prior to R have used all the
3305
available colors.  (How many colors are available depends on the X
3321
available colors.  (How many colors are available depends on the X
3306
configuration; sometimes only 256 colors can be used.)
3322
configuration; sometimes only 256 colors can be used.)
3307
 
3323
 
3308
   One application which is notorious for "eating" colors is Netscape.  If
3324
   One application which is notorious for "eating" colors is Netscape.  If
3309
the problem occurs when Netscape is running, try (re)starting it with
3325
the problem occurs when Netscape is running, try (re)starting it with
3310
either the `-no-install' (to use the default colormap) or the `-install'
3326
either the `-no-install' (to use the default colormap) or the `-install'
3311
(to install a private colormap) option.
3327
(to install a private colormap) option.
3312
 
3328
 
3313
   You could also set the `colortype' of `X11()' to `"pseudo.cube"' rather
3329
   You could also set the `colortype' of `X11()' to `"pseudo.cube"' rather
3314
than the default `"pseudo"'.  See the help page for `X11()' for more
3330
than the default `"pseudo"'.  See the help page for `X11()' for more
3315
information.
3331
information.
3316
 
3332
 
3317
7.12 How do I convert factors to numeric?
3333
7.12 How do I convert factors to numeric?
3318
=========================================
3334
=========================================
3319
 
3335
 
3320
It may happen that when reading numeric data into R (usually, when reading
3336
It may happen that when reading numeric data into R (usually, when reading
3321
in a file), they come in as factors.  If `f' is such a factor object, you
3337
in a file), they come in as factors.  If `f' is such a factor object, you
3322
can use
3338
can use
3323
 
3339
 
3324
     as.numeric(as.character(f))
3340
     as.numeric(as.character(f))
3325
 
3341
 
3326
to get the numbers back.  More efficient, but harder to remember, is
3342
to get the numbers back.  More efficient, but harder to remember, is
3327
 
3343
 
3328
     as.numeric(levels(f))[as.integer(f)]
3344
     as.numeric(levels(f))[as.integer(f)]
3329
 
3345
 
3330
   In any case, do not call `as.numeric()' or their likes directly for the
3346
   In any case, do not call `as.numeric()' or their likes directly for the
3331
task at hand (as `as.numeric()' or `unclass()' give the internal codes).
3347
task at hand (as `as.numeric()' or `unclass()' give the internal codes).
3332
 
3348
 
3333
7.13 Are Trellis displays implemented in R?
3349
7.13 Are Trellis displays implemented in R?
3334
===========================================
3350
===========================================
3335
 
3351
 
3336
The recommended package *lattice* (which is based on another recommended
3352
The recommended package *lattice* (which is based on another recommended
3337
package, *grid*) provides graphical functionality that is compatible with
3353
package, *grid*) provides graphical functionality that is compatible with
3338
most Trellis commands.
3354
most Trellis commands.
3339
 
3355
 
3340
   You could also look at `coplot()' and `dotchart()' which might do at
3356
   You could also look at `coplot()' and `dotchart()' which might do at
3341
least some of what you want.  Note also that the R version of `pairs()' is
3357
least some of what you want.  Note also that the R version of `pairs()' is
3342
fairly general and provides most of the functionality of `splom()', and
3358
fairly general and provides most of the functionality of `splom()', and
3343
that R's default plot method has an argument `asp' allowing to specify (and
3359
that R's default plot method has an argument `asp' allowing to specify (and
3344
fix against device resizing) the aspect ratio of the plot.
3360
fix against device resizing) the aspect ratio of the plot.
3345
 
3361
 
3346
   (Because the word "Trellis" has been claimed as a trademark we do not
3362
   (Because the word "Trellis" has been claimed as a trademark we do not
3347
use it in R.  The name "lattice" has been chosen for the R equivalent.)
3363
use it in R.  The name "lattice" has been chosen for the R equivalent.)
3348
 
3364
 
3349
7.14 What are the enclosing and parent environments?
3365
7.14 What are the enclosing and parent environments?
3350
====================================================
3366
====================================================
3351
 
3367
 
3352
Inside a function you may want to access variables in two additional
3368
Inside a function you may want to access variables in two additional
3353
environments: the one that the function was defined in ("enclosing"), and
3369
environments: the one that the function was defined in ("enclosing"), and
3354
the one it was invoked in ("parent").
3370
the one it was invoked in ("parent").
3355
 
3371
 
3356
   If you create a function at the command line or load it in a package its
3372
   If you create a function at the command line or load it in a package its
3357
enclosing environment is the global workspace.  If you define a function
3373
enclosing environment is the global workspace.  If you define a function
3358
`f()' inside another function `g()' its enclosing environment is the
3374
`f()' inside another function `g()' its enclosing environment is the
3359
environment inside `g()'.  The enclosing environment for a function is
3375
environment inside `g()'.  The enclosing environment for a function is
3360
fixed when the function is created.  You can find out the enclosing
3376
fixed when the function is created.  You can find out the enclosing
3361
environment for a function `f()' using `environment(f)'.
3377
environment for a function `f()' using `environment(f)'.
3362
 
3378
 
3363
   The "parent" environment, on the other hand, is defined when you invoke
3379
   The "parent" environment, on the other hand, is defined when you invoke
3364
a function.  If you invoke `lm()' at the command line its parent
3380
a function.  If you invoke `lm()' at the command line its parent
3365
environment is the global workspace, if you invoke it inside a function
3381
environment is the global workspace, if you invoke it inside a function
3366
`f()' then its parent environment is the environment inside `f()'.  You can
3382
`f()' then its parent environment is the environment inside `f()'.  You can
3367
find out the parent environment for an invocation of a function by using
3383
find out the parent environment for an invocation of a function by using
3368
`parent.frame()' or `sys.frame(sys.parent())'.
3384
`parent.frame()' or `sys.frame(sys.parent())'.
3369
 
3385
 
3370
   So for most user-visible functions the enclosing environment will be the
3386
   So for most user-visible functions the enclosing environment will be the
3371
global workspace, since that is where most functions are defined.  The
3387
global workspace, since that is where most functions are defined.  The
3372
parent environment will be wherever the function happens to be called from.
3388
parent environment will be wherever the function happens to be called from.
3373
If a function `f()' is defined inside another function `g()' it will
3389
If a function `f()' is defined inside another function `g()' it will
3374
probably be used inside `g()' as well, so its parent environment and
3390
probably be used inside `g()' as well, so its parent environment and
3375
enclosing environment will probably be the same.
3391
enclosing environment will probably be the same.
3376
 
3392
 
3377
   Parent environments are important because things like model formulas
3393
   Parent environments are important because things like model formulas
3378
need to be evaluated in the environment the function was called from, since
3394
need to be evaluated in the environment the function was called from, since
3379
that's where all the variables will be available.  This relies on the
3395
that's where all the variables will be available.  This relies on the
3380
parent environment being potentially different with each invocation.
3396
parent environment being potentially different with each invocation.
3381
 
3397
 
3382
   Enclosing environments are important because a function can use
3398
   Enclosing environments are important because a function can use
3383
variables in the enclosing environment to share information with other
3399
variables in the enclosing environment to share information with other
3384
functions or with other invocations of itself (see the section on lexical
3400
functions or with other invocations of itself (see the section on lexical
3385
scoping).  This relies on the enclosing environment being the same each
3401
scoping).  This relies on the enclosing environment being the same each
3386
time the function is invoked.
3402
time the function is invoked.
3387
 
3403
 
3388
   Scoping _is_ hard.  Looking at examples helps.  It is particularly
3404
   Scoping _is_ hard.  Looking at examples helps.  It is particularly
3389
instructive to look at examples that work differently in R and S and try to
3405
instructive to look at examples that work differently in R and S and try to
3390
see why they differ.  One way to describe the scoping differences between R
3406
see why they differ.  One way to describe the scoping differences between R
3391
and S is to say that in S the enclosing environment is _always_ the global
3407
and S is to say that in S the enclosing environment is _always_ the global
3392
workspace, but in R the enclosing environment is wherever the function was
3408
workspace, but in R the enclosing environment is wherever the function was
3393
created.
3409
created.
3394
 
3410
 
3395
7.15 How can I substitute into a plot label?
3411
7.15 How can I substitute into a plot label?
3396
============================================
3412
============================================
3397
 
3413
 
3398
Often, it is desired to use the value of an R object in a plot label, e.g.,
3414
Often, it is desired to use the value of an R object in a plot label, e.g.,
3399
a title.  This is easily accomplished using `paste()' if the label is a
3415
a title.  This is easily accomplished using `paste()' if the label is a
3400
simple character string, but not always obvious in case the label is an
3416
simple character string, but not always obvious in case the label is an
3401
expression (for refined mathematical annotation).  In such a case, either
3417
expression (for refined mathematical annotation).  In such a case, either
3402
use `parse()' on your pasted character string or use `substitute()' on an
3418
use `parse()' on your pasted character string or use `substitute()' on an
3403
expression.  For example, if `ahat' is an estimator of your parameter a of
3419
expression.  For example, if `ahat' is an estimator of your parameter a of
3404
interest, use
3420
interest, use
3405
 
3421
 
3406
     title(substitute(hat(a) == ahat, list(ahat = ahat)))
3422
     title(substitute(hat(a) == ahat, list(ahat = ahat)))
3407
 
3423
 
3408
(note that it is `==' and not `=').  There are more worked examples in the
3424
(note that it is `==' and not `=').  There are more worked examples in the
3409
mailing list achives.
3425
mailing list achives.
3410
 
3426
 
3411
7.16 What are valid names?
3427
7.16 What are valid names?
3412
==========================
3428
==========================
3413
 
3429
 
3414
When creating data frames using `data.frame()' or `read.table()', R by
3430
When creating data frames using `data.frame()' or `read.table()', R by
3415
default ensures that the variable names are syntactically valid.  (The
3431
default ensures that the variable names are syntactically valid.  (The
3416
argument `check.names' to these functions controls whether variable names
3432
argument `check.names' to these functions controls whether variable names
3417
are checked and adjusted by `make.names()' if needed.)
3433
are checked and adjusted by `make.names()' if needed.)
3418
 
3434
 
3419
   To understand what names are "valid", one needs to take into account
3435
   To understand what names are "valid", one needs to take into account
3420
that the term "name" is used in several different (but related) ways in the
3436
that the term "name" is used in several different (but related) ways in the
3421
language:
3437
language:
3422
 
3438
 
3423
  1. A _syntactic name_ is a string the parser interprets as this type of
3439
  1. A _syntactic name_ is a string the parser interprets as this type of
3424
     expression.  It consists of letters, numbers, and the dot and (for
3440
     expression.  It consists of letters, numbers, and the dot and (for
3425
     version of R at least 1.9.0) underscore characters, and starts with
3441
     version of R at least 1.9.0) underscore characters, and starts with
3426
     either a letter or a dot not followed by a number.  Reserved words are
3442
     either a letter or a dot not followed by a number.  Reserved words are
3427
     not syntactic names.
3443
     not syntactic names.
3428
 
3444
 
3429
  2. An _object name_ is a string associated with an object that is
3445
  2. An _object name_ is a string associated with an object that is
3430
     assigned in an expression either by having the object name on the left
3446
     assigned in an expression either by having the object name on the left
3431
     of an assignment operation or as an argument to the `assign()'
3447
     of an assignment operation or as an argument to the `assign()'
3432
     function.  It is usually a syntactic name as well, but can be any
3448
     function.  It is usually a syntactic name as well, but can be any
3433
     non-empty string if it is quoted (and it is always quoted in the call
3449
     non-empty string if it is quoted (and it is always quoted in the call
3434
     to `assign()').
3450
     to `assign()').
3435
 
3451
 
3436
  3. An _argument name_ is what appears to the left of the equals sign when
3452
  3. An _argument name_ is what appears to the left of the equals sign when
3437
     supplying an argument in a function call (for example, `f(trim=.5)').
3453
     supplying an argument in a function call (for example, `f(trim=.5)').
3438
     Argument names are also usually syntactic names, but again can be
3454
     Argument names are also usually syntactic names, but again can be
3439
     anything if they are quoted.
3455
     anything if they are quoted.
3440
 
3456
 
3441
  4. An _element name_ is a string that identifies a piece of an object (a
3457
  4. An _element name_ is a string that identifies a piece of an object (a
3442
     component of a list, for example.)  When it is used on the right of
3458
     component of a list, for example.)  When it is used on the right of
3443
     the `$' operator, it must be a syntactic name, or quoted.  Otherwise,
3459
     the `$' operator, it must be a syntactic name, or quoted.  Otherwise,
3444
     element names can be any strings.  (When an object is used as a
3460
     element names can be any strings.  (When an object is used as a
3445
     database, as in a call to `eval()' or `attach()', the element names
3461
     database, as in a call to `eval()' or `attach()', the element names
3446
     become object names.)
3462
     become object names.)
3447
 
3463
 
3448
  5. Finally, a _file name_ is a string identifying a file in the operating
3464
  5. Finally, a _file name_ is a string identifying a file in the operating
3449
     system for reading, writing, etc.  It really has nothing much to do
3465
     system for reading, writing, etc.  It really has nothing much to do
3450
     with names in the language, but it is traditional to call these
3466
     with names in the language, but it is traditional to call these
3451
     strings file "names".
3467
     strings file "names".
3452
 
3468
 
3453
7.17 Are GAMs implemented in R?
3469
7.17 Are GAMs implemented in R?
3454
===============================
3470
===============================
3455
 
3471
 
3456
There is a `gam()' function for Generalized Additive Models in package
3472
There is a `gam()' function for Generalized Additive Models in package
3457
*mgcv*, but it is not an exact clone of what is described in the White Book
3473
*mgcv*, but it is not an exact clone of what is described in the White Book
3458
(no `lo()' for example).  Package *gss* can fit spline-based GAMs too.  And
3474
(no `lo()' for example).  Package *gss* can fit spline-based GAMs too.  And
3459
if you can accept regression splines you can use `glm()'.  For gaussian
3475
if you can accept regression splines you can use `glm()'.  For gaussian
3460
GAMs you can use `bruto()' from package *mda*.
3476
GAMs you can use `bruto()' from package *mda*.
3461
 
3477
 
3462
7.18 Why is the output not printed when I source() a file?
3478
7.18 Why is the output not printed when I source() a file?
3463
==========================================================
3479
==========================================================
3464
 
3480
 
3465
Most R commands do not generate any output. The command
3481
Most R commands do not generate any output. The command
3466
 
3482
 
3467
     1+1
3483
     1+1
3468
 
3484
 
3469
computes the value 2 and returns it; the command
3485
computes the value 2 and returns it; the command
3470
 
3486
 
3471
     summary(glm(y~x+z, family=binomial))
3487
     summary(glm(y~x+z, family=binomial))
3472
 
3488
 
3473
fits a logistic regression model, computes some summary information and
3489
fits a logistic regression model, computes some summary information and
3474
returns an object of class `"summary.glm"' (*note How should I write
3490
returns an object of class `"summary.glm"' (*note How should I write
3475
summary methods?::).
3491
summary methods?::).
3476
 
3492
 
3477
   If you type `1+1' or `summary(glm(y~x+z, family=binomial))' at the
3493
   If you type `1+1' or `summary(glm(y~x+z, family=binomial))' at the
3478
command line the returned value is automatically printed (unless it is
3494
command line the returned value is automatically printed (unless it is
3479
`invisible()'), but in other circumstances, such as in a `source()'d file
3495
`invisible()'), but in other circumstances, such as in a `source()'d file
3480
or inside a function it isn't printed unless you specifically print it.
3496
or inside a function it isn't printed unless you specifically print it.
3481
 
3497
 
3482
   To print the value use
3498
   To print the value use
3483
 
3499
 
3484
     print(1+1)
3500
     print(1+1)
3485
 
3501
 
3486
or
3502
or
3487
 
3503
 
3488
     print(summary(glm(y~x+z, family=binomial)))
3504
     print(summary(glm(y~x+z, family=binomial)))
3489
 
3505
 
3490
instead, or use `source(FILE, echo=TRUE)'.
3506
instead, or use `source(FILE, echo=TRUE)'.
3491
 
3507
 
3492
7.19 Why does outer() behave strangely with my function?
3508
7.19 Why does outer() behave strangely with my function?
3493
========================================================
3509
========================================================
3494
 
3510
 
3495
As the help for `outer()' indicates, it does not work on arbitrary
3511
As the help for `outer()' indicates, it does not work on arbitrary
3496
functions the way the `apply()' family does.  It requires functions that
3512
functions the way the `apply()' family does.  It requires functions that
3497
are vectorized to work elementwise on arrays.  As you can see by looking at
3513
are vectorized to work elementwise on arrays.  As you can see by looking at
3498
the code, `outer(x, y, FUN)' creates two large vectors containing every
3514
the code, `outer(x, y, FUN)' creates two large vectors containing every
3499
possible combination of elements of `x' and `y' and then passes this to
3515
possible combination of elements of `x' and `y' and then passes this to
3500
`FUN' all at once.  Your function probably cannot handle two large vectors
3516
`FUN' all at once.  Your function probably cannot handle two large vectors
3501
as parameters.
3517
as parameters.
3502
 
3518
 
3503
   If you have a function that cannot handle two vectors but can handle two
3519
   If you have a function that cannot handle two vectors but can handle two
3504
scalars, then you can still use `outer()' but you will need to wrap your
3520
scalars, then you can still use `outer()' but you will need to wrap your
3505
function up first, to simulate vectorized behavior.  Suppose your function
3521
function up first, to simulate vectorized behavior.  Suppose your function
3506
is
3522
is
3507
 
3523
 
3508
     foo <- function(x, y, happy) {
3524
     foo <- function(x, y, happy) {
3509
       stopifnot(length(x) == 1, length(y) == 1) # scalars only!
3525
       stopifnot(length(x) == 1, length(y) == 1) # scalars only!
3510
       (x + y) * happy
3526
       (x + y) * happy
3511
     }
3527
     }
3512
 
3528
 
3513
If you define the general function
3529
If you define the general function
3514
 
3530
 
3515
     wrapper <- function(x, y, my.fun, ...) {
3531
     wrapper <- function(x, y, my.fun, ...) {
3516
       sapply(seq(along = x), FUN = function(i) my.fun(x[i], y[i], ...))
3532
       sapply(seq(along = x), FUN = function(i) my.fun(x[i], y[i], ...))
3517
     }
3533
     }
3518
 
3534
 
3519
then you can use `outer()' by writing, e.g.,
3535
then you can use `outer()' by writing, e.g.,
3520
 
3536
 
3521
     outer(1:4, 1:2, FUN = wrapper, my.fun = foo, happy = 10)
3537
     outer(1:4, 1:2, FUN = wrapper, my.fun = foo, happy = 10)
3522
 
3538
 
3523
7.20 Why does the output from anova() depend on the order of factors in the model?
3539
7.20 Why does the output from anova() depend on the order of factors in the model?
3524
==================================================================================
3540
==================================================================================
3525
 
3541
 
3526
In a model such as `~A+B+A:B', R will report the difference in sums of
3542
In a model such as `~A+B+A:B', R will report the difference in sums of
3527
squares between the models `~1', `~A', `~A+B' and `~A+B+A:B'.  If the model
3543
squares between the models `~1', `~A', `~A+B' and `~A+B+A:B'.  If the model
3528
were `~B+A+A:B', R would report differences between `~1', `~B', `~A+B', and
3544
were `~B+A+A:B', R would report differences between `~1', `~B', `~A+B', and
3529
`~A+B+A:B' . In the first case the sum of squares for `A' is comparing `~1'
3545
`~A+B+A:B' . In the first case the sum of squares for `A' is comparing `~1'
3530
and `~A', in the second case it is comparing `~B' and `~B+A'.  In a
3546
and `~A', in the second case it is comparing `~B' and `~B+A'.  In a
3531
non-orthogonal design (i.e., most unbalanced designs) these comparisons are
3547
non-orthogonal design (i.e., most unbalanced designs) these comparisons are
3532
(conceptually and numerically) different.
3548
(conceptually and numerically) different.
3533
 
3549
 
3534
   Some packages report instead the sums of squares based on comparing the
3550
   Some packages report instead the sums of squares based on comparing the
3535
full model to the models with each factor removed one at a time (the famous
3551
full model to the models with each factor removed one at a time (the famous
3536
`Type III sums of squares' from SAS, for example).  These do not depend on
3552
`Type III sums of squares' from SAS, for example).  These do not depend on
3537
the order of factors in the model.  The question of which set of sums of
3553
the order of factors in the model.  The question of which set of sums of
3538
squares is the Right Thing provokes low-level holy wars on R-help from time
3554
squares is the Right Thing provokes low-level holy wars on R-help from time
3539
to time.
3555
to time.
3540
 
3556
 
3541
   There is no need to be agitated about the particular sums of squares
3557
   There is no need to be agitated about the particular sums of squares
3542
that R reports.  You can compute your favorite sums of squares quite
3558
that R reports.  You can compute your favorite sums of squares quite
3543
easily.  Any two models can be compared with `anova(MODEL1, MODEL2)', and
3559
easily.  Any two models can be compared with `anova(MODEL1, MODEL2)', and
3544
`drop1(MODEL1)' will show the sums of squares resulting from dropping
3560
`drop1(MODEL1)' will show the sums of squares resulting from dropping
3545
single terms.
3561
single terms.
3546
 
3562
 
3547
7.21 How do I produce PNG graphics in batch mode?
3563
7.21 How do I produce PNG graphics in batch mode?
3548
=================================================
3564
=================================================
3549
 
3565
 
3550
Under Unix, the `png()' device uses the X11 driver, which is a problem in
3566
Under Unix, the `png()' device uses the X11 driver, which is a problem in
3551
batch mode or for remote operation.  If you have Ghostscript you can use
3567
batch mode or for remote operation.  If you have Ghostscript you can use
3552
`bitmap()', which produces a PostScript file then converts it to any bitmap
3568
`bitmap()', which produces a PostScript file then converts it to any bitmap
3553
format supported by ghostscript.  On some installations this produces ugly
3569
format supported by ghostscript.  On some installations this produces ugly
3554
output, on others it is perfectly satisfactory.  In theory one could also
3570
output, on others it is perfectly satisfactory.  In theory one could also
3555
use Xvfb, which provides an X server with no display.
3571
use Xvfb, which provides an X server with no display.
3556
 
3572
 
3557
7.22 How can I get command line editing to work?
3573
7.22 How can I get command line editing to work?
3558
================================================
3574
================================================
3559
 
3575
 
3560
The Unix command-line interface to R can only provide the inbuilt command
3576
The Unix command-line interface to R can only provide the inbuilt command
3561
line editor which allows recall, editing and re-submission of prior
3577
line editor which allows recall, editing and re-submission of prior
3562
commands provided that the GNU readline library is available at the time R
3578
commands provided that the GNU readline library is available at the time R
3563
is configured for compilation.  Note that the `development' version of
3579
is configured for compilation.  Note that the `development' version of
3564
readline including the appropriate headers is needed: users of Linux binary
3580
readline including the appropriate headers is needed: users of Linux binary
3565
distributions will need to install packages such as `libreadline-dev'
3581
distributions will need to install packages such as `libreadline-dev'
3566
(Debian) or `readline-devel' (Red Hat).
3582
(Debian) or `readline-devel' (Red Hat).
3567
 
3583
 
3568
7.23 How can I turn a string into a variable?
3584
7.23 How can I turn a string into a variable?
3569
=============================================
3585
=============================================
3570
 
3586
 
3571
If you have
3587
If you have
3572
 
3588
 
3573
     varname <- c("a", "b", "d")
3589
     varname <- c("a", "b", "d")
3574
 
3590
 
3575
you can do
3591
you can do
3576
 
3592
 
3577
     get(varname[1]) + 2
3593
     get(varname[1]) + 2
3578
 
3594
 
3579
for
3595
for
3580
 
3596
 
3581
     a + 2
3597
     a + 2
3582
 
3598
 
3583
or
3599
or
3584
 
3600
 
3585
     assign(varname[1], 2 + 2)
3601
     assign(varname[1], 2 + 2)
3586
 
3602
 
3587
for
3603
for
3588
 
3604
 
3589
     a <- 2 + 2
3605
     a <- 2 + 2
3590
 
3606
 
3591
or
3607
or
3592
 
3608
 
3593
     eval(substitute(lm(y ~ x + variable),
3609
     eval(substitute(lm(y ~ x + variable),
3594
                     list(variable = as.name(varname[1]))
3610
                     list(variable = as.name(varname[1]))
3595
 
3611
 
3596
for
3612
for
3597
 
3613
 
3598
     lm(y ~ x + a)
3614
     lm(y ~ x + a)
3599
 
3615
 
3600
   At least in the first two cases it is often easier to just use a list,
3616
   At least in the first two cases it is often easier to just use a list,
3601
and then you can easily index it by name
3617
and then you can easily index it by name
3602
 
3618
 
3603
     vars <- list(a = 1:10, b = rnorm(100), d = LETTERS)
3619
     vars <- list(a = 1:10, b = rnorm(100), d = LETTERS)
3604
     vars[["a"]]
3620
     vars[["a"]]
3605
 
3621
 
3606
without any of this messing about.
3622
without any of this messing about.
3607
 
3623
 
3608
7.24 Why do lattice/trellis graphics not work?
3624
7.24 Why do lattice/trellis graphics not work?
3609
==============================================
3625
==============================================
3610
 
3626
 
3611
The most likely reason is that you forgot to tell R to display the graph.
3627
The most likely reason is that you forgot to tell R to display the graph.
3612
Lattice functions such as `xyplot()' create a graph object, but do not
3628
Lattice functions such as `xyplot()' create a graph object, but do not
3613
display it (the same is true of Trellis graphics in S-PLUS).  The `print()'
3629
display it (the same is true of Trellis graphics in S-PLUS).  The `print()'
3614
method for the graph object produces the actual display.  When you use
3630
method for the graph object produces the actual display.  When you use
3615
these functions interactively at the command line, the result is
3631
these functions interactively at the command line, the result is
3616
automatically printed, but in `source()' or inside your own functions you
3632
automatically printed, but in `source()' or inside your own functions you
3617
will need an explicit `print()' statement.
3633
will need an explicit `print()' statement.
3618
 
3634
 
3619
7.25 How can I sort the rows of a data frame?
3635
7.25 How can I sort the rows of a data frame?
3620
=============================================
3636
=============================================
3621
 
3637
 
3622
To sort the rows within a data frame, with respect to the values in one or
3638
To sort the rows within a data frame, with respect to the values in one or
3623
more of the columns, simply use `order()'.
3639
more of the columns, simply use `order()'.
3624
 
3640
 
3625
8 R Programming
3641
8 R Programming
3626
***************
3642
***************
3627
 
3643
 
3628
8.1 How should I write summary methods?
3644
8.1 How should I write summary methods?
3629
=======================================
3645
=======================================
3630
 
3646
 
3631
Suppose you want to provide a summary method for class `"foo"'.  Then
3647
Suppose you want to provide a summary method for class `"foo"'.  Then
3632
`summary.foo()' should not print anything, but return an object of class
3648
`summary.foo()' should not print anything, but return an object of class
3633
`"summary.foo"', _and_ you should write a method `print.summary.foo()'
3649
`"summary.foo"', _and_ you should write a method `print.summary.foo()'
3634
which nicely prints the summary information and invisibly returns its
3650
which nicely prints the summary information and invisibly returns its
3635
object.  This approach is preferred over having `summary.foo()' print
3651
object.  This approach is preferred over having `summary.foo()' print
3636
summary information and return something useful, as sometimes you need to
3652
summary information and return something useful, as sometimes you need to
3637
grab something computed by `summary()' inside a function or similar.  In
3653
grab something computed by `summary()' inside a function or similar.  In
3638
such cases you don't want anything printed.
3654
such cases you don't want anything printed.
3639
 
3655
 
3640
8.2 How can I debug dynamically loaded code?
3656
8.2 How can I debug dynamically loaded code?
3641
============================================
3657
============================================
3642
 
3658
 
3643
Roughly speaking, you need to start R inside the debugger, load the code,
3659
Roughly speaking, you need to start R inside the debugger, load the code,
3644
send an interrupt, and then set the required breakpoints.
3660
send an interrupt, and then set the required breakpoints.
3645
 
3661
 
3646
   See section "Finding entry points in dynamically loaded code" in
3662
   See section "Finding entry points in dynamically loaded code" in
3647
`Writing R Extensions'.  This manual is included in the R distribution,
3663
`Writing R Extensions'.  This manual is included in the R distribution,
3648
*note What documentation exists for R?::.
3664
*note What documentation exists for R?::.
3649
 
3665
 
3650
8.3 How can I inspect R objects when debugging?
3666
8.3 How can I inspect R objects when debugging?
3651
===============================================
3667
===============================================
3652
 
3668
 
3653
The most convenient way is to call `R_PV' from the symbolic debugger.
3669
The most convenient way is to call `R_PV' from the symbolic debugger.
3654
 
3670
 
3655
   See section "Inspecting R objects when debugging" in `Writing R
3671
   See section "Inspecting R objects when debugging" in `Writing R
3656
Extensions'.
3672
Extensions'.
3657
 
3673
 
3658
8.4 How can I change compilation flags?
3674
8.4 How can I change compilation flags?
3659
=======================================
3675
=======================================
3660
 
3676
 
3661
Suppose you have C code file for dynloading into R, but you want to use `R
3677
Suppose you have C code file for dynloading into R, but you want to use `R
3662
CMD SHLIB' with compilation flags other than the default ones (which were
3678
CMD SHLIB' with compilation flags other than the default ones (which were
3663
determined when R was built).  You could change the file
3679
determined when R was built).  You could change the file
3664
``R_HOME'/etc/Makeconf' to reflect your preferences.  If you are a Bourne
3680
``R_HOME'/etc/Makeconf' to reflect your preferences.  If you are a Bourne
3665
shell user, you can also pass the desired flags to Make (which is used for
3681
shell user, you can also pass the desired flags to Make (which is used for
3666
controlling compilation) via the Make variable `MAKEFLAGS', as in
3682
controlling compilation) via the Make variable `MAKEFLAGS', as in
3667
 
3683
 
3668
     MAKEFLAGS="CFLAGS=-O3" R CMD SHLIB *.c
3684
     MAKEFLAGS="CFLAGS=-O3" R CMD SHLIB *.c
3669
 
3685
 
3670
9 R Bugs
3686
9 R Bugs
3671
********
3687
********
3672
 
3688
 
3673
9.1 What is a bug?
3689
9.1 What is a bug?
3674
==================
3690
==================
3675
 
3691
 
3676
If R executes an illegal instruction, or dies with an operating system
3692
If R executes an illegal instruction, or dies with an operating system
3677
error message that indicates a problem in the program (as opposed to
3693
error message that indicates a problem in the program (as opposed to
3678
something like "disk full"), then it is certainly a bug.  If you call
3694
something like "disk full"), then it is certainly a bug.  If you call
3679
`.C()', `.Fortran()', `.External()' or `.Call()' (or `.Internal()')
3695
`.C()', `.Fortran()', `.External()' or `.Call()' (or `.Internal()')
3680
yourself (or in a function you wrote), you can always crash R by using
3696
yourself (or in a function you wrote), you can always crash R by using
3681
wrong argument types (modes).  This is not a bug.
3697
wrong argument types (modes).  This is not a bug.
3682
 
3698
 
3683
   Taking forever to complete a command can be a bug, but you must make
3699
   Taking forever to complete a command can be a bug, but you must make
3684
certain that it was really R's fault.  Some commands simply take a long
3700
certain that it was really R's fault.  Some commands simply take a long
3685
time.  If the input was such that you _know_ it should have been processed
3701
time.  If the input was such that you _know_ it should have been processed
3686
quickly, report a bug.  If you don't know whether the command should take a
3702
quickly, report a bug.  If you don't know whether the command should take a
3687
long time, find out by looking in the manual or by asking for assistance.
3703
long time, find out by looking in the manual or by asking for assistance.
3688
 
3704
 
3689
   If a command you are familiar with causes an R error message in a case
3705
   If a command you are familiar with causes an R error message in a case
3690
where its usual definition ought to be reasonable, it is probably a bug.
3706
where its usual definition ought to be reasonable, it is probably a bug.
3691
If a command does the wrong thing, that is a bug.  But be sure you know for
3707
If a command does the wrong thing, that is a bug.  But be sure you know for
3692
certain what it ought to have done.  If you aren't familiar with the
3708
certain what it ought to have done.  If you aren't familiar with the
3693
command, or don't know for certain how the command is supposed to work,
3709
command, or don't know for certain how the command is supposed to work,
3694
then it might actually be working right.  Rather than jumping to
3710
then it might actually be working right.  Rather than jumping to
3695
conclusions, show the problem to someone who knows for certain.
3711
conclusions, show the problem to someone who knows for certain.
3696
 
3712
 
3697
   Finally, a command's intended definition may not be best for statistical
3713
   Finally, a command's intended definition may not be best for statistical
3698
analysis.  This is a very important sort of problem, but it is also a
3714
analysis.  This is a very important sort of problem, but it is also a
3699
matter of judgment.  Also, it is easy to come to such a conclusion out of
3715
matter of judgment.  Also, it is easy to come to such a conclusion out of
3700
ignorance of some of the existing features.  It is probably best not to
3716
ignorance of some of the existing features.  It is probably best not to
3701
complain about such a problem until you have checked the documentation in
3717
complain about such a problem until you have checked the documentation in
3702
the usual ways, feel confident that you understand it, and know for certain
3718
the usual ways, feel confident that you understand it, and know for certain
3703
that what you want is not available.  If you are not sure what the command
3719
that what you want is not available.  If you are not sure what the command
3704
is supposed to do after a careful reading of the manual this indicates a
3720
is supposed to do after a careful reading of the manual this indicates a
3705
bug in the manual.  The manual's job is to make everything clear.  It is
3721
bug in the manual.  The manual's job is to make everything clear.  It is
3706
just as important to report documentation bugs as program bugs.  However,
3722
just as important to report documentation bugs as program bugs.  However,
3707
we know that the introductory documentation is seriously inadequate, so you
3723
we know that the introductory documentation is seriously inadequate, so you
3708
don't need to report this.
3724
don't need to report this.
3709
 
3725
 
3710
   If the online argument list of a function disagrees with the manual, one
3726
   If the online argument list of a function disagrees with the manual, one
3711
of them must be wrong, so report the bug.
3727
of them must be wrong, so report the bug.
3712
 
3728
 
3713
9.2 How to report a bug
3729
9.2 How to report a bug
3714
=======================
3730
=======================
3715
 
3731
 
3716
When you decide that there is a bug, it is important to report it and to
3732
When you decide that there is a bug, it is important to report it and to
3717
report it in a way which is useful.  What is most useful is an exact
3733
report it in a way which is useful.  What is most useful is an exact
3718
description of what commands you type, starting with the shell command to
3734
description of what commands you type, starting with the shell command to
3719
run R, until the problem happens.  Always include the version of R,
3735
run R, until the problem happens.  Always include the version of R,
3720
machine, and operating system that you are using; type `version' in R to
3736
machine, and operating system that you are using; type `version' in R to
3721
print this.
3737
print this.
3722
 
3738
 
3723
   The most important principle in reporting a bug is to report _facts_,
3739
   The most important principle in reporting a bug is to report _facts_,
3724
not hypotheses or categorizations.  It is always easier to report the
3740
not hypotheses or categorizations.  It is always easier to report the
3725
facts, but people seem to prefer to strain to posit explanations and report
3741
facts, but people seem to prefer to strain to posit explanations and report
3726
them instead.  If the explanations are based on guesses about how R is
3742
them instead.  If the explanations are based on guesses about how R is
3727
implemented, they will be useless; others will have to try to figure out
3743
implemented, they will be useless; others will have to try to figure out
3728
what the facts must have been to lead to such speculations.  Sometimes this
3744
what the facts must have been to lead to such speculations.  Sometimes this
3729
is impossible.  But in any case, it is unnecessary work for the ones trying
3745
is impossible.  But in any case, it is unnecessary work for the ones trying
3730
to fix the problem.
3746
to fix the problem.
3731
 
3747
 
3732
   For example, suppose that on a data set which you know to be quite large
3748
   For example, suppose that on a data set which you know to be quite large
3733
the command
3749
the command
3734
 
3750
 
3735
     R> data.frame(x, y, z, monday, tuesday)
3751
     R> data.frame(x, y, z, monday, tuesday)
3736
 
3752
 
3737
never returns.  Do not report that `data.frame()' fails for large data
3753
never returns.  Do not report that `data.frame()' fails for large data
3738
sets.  Perhaps it fails when a variable name is a day of the week.  If this
3754
sets.  Perhaps it fails when a variable name is a day of the week.  If this
3739
is so then when others got your report they would try out the
3755
is so then when others got your report they would try out the
3740
`data.frame()' command on a large data set, probably with no day of the
3756
`data.frame()' command on a large data set, probably with no day of the
3741
week variable name, and not see any problem.  There is no way in the world
3757
week variable name, and not see any problem.  There is no way in the world
3742
that others could guess that they should try a day of the week variable
3758
that others could guess that they should try a day of the week variable
3743
name.
3759
name.
3744
 
3760
 
3745
   Or perhaps the command fails because the last command you used was a
3761
   Or perhaps the command fails because the last command you used was a
3746
method for `"["()' that had a bug causing R's internal data structures to
3762
method for `"["()' that had a bug causing R's internal data structures to
3747
be corrupted and making the `data.frame()' command fail from then on.  This
3763
be corrupted and making the `data.frame()' command fail from then on.  This
3748
is why others need to know what other commands you have typed (or read from
3764
is why others need to know what other commands you have typed (or read from
3749
your startup file).
3765
your startup file).
3750
 
3766
 
3751
   It is very useful to try and find simple examples that produce
3767
   It is very useful to try and find simple examples that produce
3752
apparently the same bug, and somewhat useful to find simple examples that
3768
apparently the same bug, and somewhat useful to find simple examples that
3753
might be expected to produce the bug but actually do not.  If you want to
3769
might be expected to produce the bug but actually do not.  If you want to
3754
debug the problem and find exactly what caused it, that is wonderful.  You
3770
debug the problem and find exactly what caused it, that is wonderful.  You
3755
should still report the facts as well as any explanations or solutions.
3771
should still report the facts as well as any explanations or solutions.
3756
Please include an example that reproduces the problem, preferably the
3772
Please include an example that reproduces the problem, preferably the
3757
simplest one you have found.
3773
simplest one you have found.
3758
 
3774
 
3759
   Invoking R with the `--vanilla' option may help in isolating a bug.
3775
   Invoking R with the `--vanilla' option may help in isolating a bug.
3760
This ensures that the site profile and saved data files are not read.
3776
This ensures that the site profile and saved data files are not read.
3761
 
3777
 
3762
   On Unix systems a bug report can be generated using the function
3778
   On Unix systems a bug report can be generated using the function
3763
`bug.report()'.  This automatically includes the version information and
3779
`bug.report()'.  This automatically includes the version information and
3764
sends the bug to the correct address.  Alternatively the bug report can be
3780
sends the bug to the correct address.  Alternatively the bug report can be
3765
emailed to <R-bugs@R-project.org> or submitted to the Web page at
3781
emailed to <R-bugs@R-project.org> or submitted to the Web page at
3766
`http://bugs.R-project.org/'.
3782
`http://bugs.R-project.org/'.
3767
 
3783
 
3768
   Bug reports on contributed packages should perhaps be sent to the
3784
   Bug reports on contributed packages should perhaps be sent to the
3769
package maintainer rather than to R-bugs.
3785
package maintainer rather than to R-bugs.
3770
 
3786
 
3771
10 Acknowledgments
3787
10 Acknowledgments
3772
******************
3788
******************
3773
 
3789
 
3774
Of course, many many thanks to Robert and Ross for the R system, and to the
3790
Of course, many many thanks to Robert and Ross for the R system, and to the
3775
package writers and porters for adding to it.
3791
package writers and porters for adding to it.
3776
 
3792
 
3777
   Special thanks go to Doug Bates, Peter Dalgaard, Paul Gilbert, Stefano
3793
   Special thanks go to Doug Bates, Peter Dalgaard, Paul Gilbert, Stefano
3778
Iacus, Fritz Leisch, Jim Lindsey, Thomas Lumley, Martin Maechler, Brian D.
3794
Iacus, Fritz Leisch, Jim Lindsey, Thomas Lumley, Martin Maechler, Brian D.
3779
Ripley, Anthony Rossini, and Andreas Weingessel for their comments which
3795
Ripley, Anthony Rossini, and Andreas Weingessel for their comments which
3780
helped me improve this FAQ.
3796
helped me improve this FAQ.
3781
 
3797
 
3782
   More to some soon ...
3798
   More to some soon ...
3783
 
3799