The R Project SVN R

Rev

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

Rev 28322 Rev 28348
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-41, 2004-02-16
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 MJ Ray <mjr@dsl.pipex.com>.  It
1161
   *Rcgi* is a CGI WWW interface to R by MJ Ray <mjr@dsl.pipex.com>.  It
1162
had the ability to use "embedded code": you could mix user input and code,
1162
had the ability to use "embedded code": you could mix user input and code,
1163
allowing the HTML author to do anything from load in data sets to enter
1163
allowing the HTML author to do anything from load in data sets to enter
1164
most of the commands for users without writing CGI scripts.  Graphical
1164
most of the commands for users without writing CGI scripts.  Graphical
1165
output was possible in PostScript or GIF formats and the executed code was
1165
output was possible in PostScript or GIF formats and the executed code was
1166
presented to the user for revision.  However, it is not clear if the
1166
presented to the user for revision.  However, it is not clear if the
1167
project is still active.  Currently, a modified version of *Rcgi* by Mai
1167
project is still active.  Currently, a modified version of *Rcgi* by Mai
1168
Zhou <mai@ms.uky.edu> (actually, two versions: one with (bitmap) graphics
1168
Zhou <mai@ms.uky.edu> (actually, two versions: one with (bitmap) graphics
1169
and one without) as well as the original code are available from
1169
and one without) as well as the original code are available from
1170
`http://www.ms.uky.edu/~statweb'.
1170
`http://www.ms.uky.edu/~statweb'.
1171
 
1171
 
1172
5 R Add-On Packages
1172
5 R Add-On Packages
1173
*******************
1173
*******************
1174
 
1174
 
1175
5.1 Which add-on packages exist for R?
1175
5.1 Which add-on packages exist for R?
1176
======================================
1176
======================================
1177
 
1177
 
1178
5.1.1 Add-on packages in R
1178
5.1.1 Add-on packages in R
1179
--------------------------
1179
--------------------------
1180
 
1180
 
1181
The R distribution comes with the following extra packages:
1181
The R distribution comes with the following extra packages:
1182
 
1182
 
1183
*ctest*
1183
*ctest*
1184
     A collection of Classical TESTs, including the Ansari-Bradley,
1184
     A collection of Classical TESTs, including the Ansari-Bradley,
1185
     Bartlett, chi-squared, Fisher, Kruskal-Wallis, Kolmogorov-Smirnov, t,
1185
     Bartlett, chi-squared, Fisher, Kruskal-Wallis, Kolmogorov-Smirnov, t,
1186
     and Wilcoxon tests.
1186
     and Wilcoxon tests.
1187
 
1187
 
1188
*eda*
1188
*eda*
1189
     Exploratory Data Analysis.  Currently only contains functions for
1189
     Exploratory Data Analysis.  Currently only contains functions for
1190
     robust line fitting, and median polish and smoothing.
1190
     robust line fitting, and median polish and smoothing.
1191
 
1191
 
1192
*grid*
1192
*grid*
1193
     A rewrite of the graphics layout capabilities, plus some support for
1193
     A rewrite of the graphics layout capabilities, plus some support for
1194
     interaction.  (Added in R 1.8.0).
1194
     interaction.  (Added in R 1.8.0).
1195
 
1195
 
1196
*lqs*
1196
*lqs*
1197
     Resistant regression and covariance estimation.
1197
     Resistant regression and covariance estimation.
1198
 
1198
 
1199
*methods*
1199
*methods*
1200
     Formally defined methods and classes for R objects, plus other
1200
     Formally defined methods and classes for R objects, plus other
1201
     programming tools, as described in the Green Book.
1201
     programming tools, as described in the Green Book.
1202
 
1202
 
1203
*mle*
1203
*mle*
1204
     Generic (smooth) likelihood maximization and profiling.  (Added in R
1204
     Generic (smooth) likelihood maximization and profiling.  (Added in R
1205
     1.8.0).
1205
     1.8.0).
1206
 
1206
 
1207
*modreg*
1207
*modreg*
1208
     MODern REGression: smoothing and local methods.
1208
     MODern REGression: smoothing and local methods.
1209
 
1209
 
1210
*mva*
1210
*mva*
1211
     MultiVariate Analysis.  Currently contains code for principal
1211
     MultiVariate Analysis.  Currently contains code for principal
1212
     components, canonical correlations, metric multidimensional scaling,
1212
     components, canonical correlations, metric multidimensional scaling,
1213
     factor analysis, and hierarchical and k-means clustering.
1213
     factor analysis, and hierarchical and k-means clustering.
1214
 
1214
 
1215
*nls*
1215
*nls*
1216
     Nonlinear regression routines.
1216
     Nonlinear regression routines.
1217
 
1217
 
1218
*splines*
1218
*splines*
1219
     Regression spline functions and classes.
1219
     Regression spline functions and classes.
1220
 
1220
 
1221
*stepfun*
1221
*stepfun*
1222
     Code for dealing with STEP FUNctions, including empirical cumulative
1222
     Code for dealing with STEP FUNctions, including empirical cumulative
1223
     distribution functions.
1223
     distribution functions.
1224
 
1224
 
1225
*tcltk*
1225
*tcltk*
1226
     Interface and language bindings to Tcl/Tk GUI elements.
1226
     Interface and language bindings to Tcl/Tk GUI elements.
1227
 
1227
 
1228
*tools*
1228
*tools*
1229
     Tools for package development and administration.
1229
     Tools for package development and administration.
1230
 
1230
 
1231
*ts*
1231
*ts*
1232
     Time Series.
1232
     Time Series.
1233
   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*,
1234
*graphics*, *stats*, and *utils*.  Packages *ctest*, *eda*, *modreg*, *mva*,
1234
*graphics*, *stats*, and *utils*.  Packages *ctest*, *eda*, *modreg*, *mva*,
1235
*nls*, *stepfun* and *ts* will be merged into *stats*, package *lqs*
1235
*nls*, *stepfun* and *ts* will be merged into *stats*, package *lqs*
1236
returned to the recommended package *MASS*, and package *mle* moved to
1236
returned to the recommended package *MASS*, and package *mle* moved to
1237
*stats4*.
1237
*stats4*.
1238
 
1238
 
1239
5.1.2 Add-on packages from CRAN
1239
5.1.2 Add-on packages from CRAN
1240
-------------------------------
1240
-------------------------------
1241
 
1241
 
1242
The following packages are available from the CRAN `src/contrib' area.
1242
The following packages are available from the CRAN `src/contrib' area.
1243
(Packages denoted as _Recommended_ are to be included in all binary
1243
(Packages denoted as _Recommended_ are to be included in all binary
1244
distributions of R.)
1244
distributions of R.)
1245
 
1245
 
1246
*AlgDesign*
1246
*AlgDesign*
1247
     Algorithmic experimental designs.  Calculates exact and approximate
1247
     Algorithmic experimental designs.  Calculates exact and approximate
1248
     theory experimental designs for D, A, and I criteria.
1248
     theory experimental designs for D, A, and I criteria.
1249
 
1249
 
1250
*AnalyzeFMRI*
1250
*AnalyzeFMRI*
1251
     Functions for I/O, visualisation and analysis of functional Magnetic
1251
     Functions for I/O, visualisation and analysis of functional Magnetic
1252
     Resonance Imaging (fMRI) datasets stored in the ANALYZE format.
1252
     Resonance Imaging (fMRI) datasets stored in the ANALYZE format.
1253
 
1253
 
1254
*Bhat*
1254
*Bhat*
1255
     Functions for general likelihood exploration (MLE, MCMC, CIs).
1255
     Functions for general likelihood exploration (MLE, MCMC, CIs).
1256
 
1256
 
1257
*BradleyTerry*
1257
*BradleyTerry*
1258
     Specify and fit the Bradley-Terry model and structured versions.
1258
     Specify and fit the Bradley-Terry model and structured versions.
1259
 
1259
 
1260
*BsMD*
1260
*BsMD*
1261
     Bayes screening and model discrimination follow-up designs.
1261
     Bayes screening and model discrimination follow-up designs.
1262
 
1262
 
1263
*CDNmoney*
1263
*CDNmoney*
1264
     Components of Canadian monetary aggregates.
1264
     Components of Canadian monetary aggregates.
1265
 
1265
 
1266
*CGIwithR*
1266
*CGIwithR*
1267
     Facilities for the use of R to write CGI scripts.
1267
     Facilities for the use of R to write CGI scripts.
1268
 
1268
 
1269
*CircStats*
1269
*CircStats*
1270
     Circular Statistics, from "Topics in Circular Statistics" by S. Rao
1270
     Circular Statistics, from "Topics in Circular Statistics" by S. Rao
1271
     Jammalamadaka and A. SenGupta, 2001, World Scientific.
1271
     Jammalamadaka and A. SenGupta, 2001, World Scientific.
1272
 
1272
 
1273
*CoCoAn*
1273
*CoCoAn*
1274
     Constrained Correspondence Analysis.
1274
     Constrained Correspondence Analysis.
1275
 
1275
 
1276
*DAAG*
1276
*DAAG*
1277
     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
1278
     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.
1279
 
1279
 
1280
*DBI*
1280
*DBI*
1281
     A common database interface (DBI) class and method definitions.  All
1281
     A common database interface (DBI) class and method definitions.  All
1282
     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
1283
     various DBMS implementations.
1283
     various DBMS implementations.
1284
 
1284
 
1285
*Davies*
1285
*Davies*
1286
     Functions for the Davies quantile function and the Generalized Lambda
1286
     Functions for the Davies quantile function and the Generalized Lambda
1287
     distribution.
1287
     distribution.
1288
 
1288
 
1289
*Design*
1289
*Design*
1290
     Regression modeling, testing, estimation, validation, graphics,
1290
     Regression modeling, testing, estimation, validation, graphics,
1291
     prediction, and typesetting by storing enhanced model design attributes
1291
     prediction, and typesetting by storing enhanced model design attributes
1292
     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
1293
     and streamline modeling, especially for biostatistical and
1293
     and streamline modeling, especially for biostatistical and
1294
     epidemiologic applications.  It also contains new functions for binary
1294
     epidemiologic applications.  It also contains new functions for binary
1295
     and ordinal logistic regression models and the Buckley-James multiple
1295
     and ordinal logistic regression models and the Buckley-James multiple
1296
     regression model for right-censored responses, and implements
1296
     regression model for right-censored responses, and implements
1297
     penalized maximum likelihood estimation for logistic and ordinary
1297
     penalized maximum likelihood estimation for logistic and ordinary
1298
     linear models.  Design works with almost any regression model, but it
1298
     linear models.  Design works with almost any regression model, but it
1299
     was especially written to work with logistic regression, Cox
1299
     was especially written to work with logistic regression, Cox
1300
     regression, accelerated failure time models, ordinary linear models,
1300
     regression, accelerated failure time models, ordinary linear models,
1301
     and the Buckley-James model.
1301
     and the Buckley-James model.
1302
 
1302
 
1303
*Devore5*
1303
*Devore5*
1304
     Data sets and sample analyses from "Probability and Statistics for
1304
     Data sets and sample analyses from "Probability and Statistics for
1305
     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.
1306
 
1306
 
1307
*Devore6*
1307
*Devore6*
1308
     Data sets and sample analyses from "Probability and Statistics for
1308
     Data sets and sample analyses from "Probability and Statistics for
1309
     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.
1310
 
1310
 
1311
*EMV*
1311
*EMV*
1312
     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
1313
     algorithm.
1313
     algorithm.
1314
 
1314
 
1315
*GRASS*
1315
*GRASS*
1316
     An interface between the GRASS geographical information system and R,
1316
     An interface between the GRASS geographical information system and R,
1317
     based on starting R from within the GRASS environment and chosen
1317
     based on starting R from within the GRASS environment and chosen
1318
     LOCATION_NAME and MAPSET.  Wrapper and helper functions are provided
1318
     LOCATION_NAME and MAPSET.  Wrapper and helper functions are provided
1319
     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.
1320
 
1320
 
1321
*GenKern*
1321
*GenKern*
1322
     Functions for generating and manipulating generalised binned kernel
1322
     Functions for generating and manipulating generalised binned kernel
1323
     density estimates.
1323
     density estimates.
1324
 
1324
 
1325
*GeneTS*
1325
*GeneTS*
1326
     A package for analysing multiple gene expression time series data.
1326
     A package for analysing multiple gene expression time series data.
1327
     Currently, implements methods for cell cycle analysis and for inferring
1327
     Currently, implements methods for cell cycle analysis and for inferring
1328
     large sparse graphical Gaussian models.
1328
     large sparse graphical Gaussian models.
1329
 
1329
 
1330
*HI*
1330
*HI*
1331
     Simulation from distributions supported by nested hyperplanes.
1331
     Simulation from distributions supported by nested hyperplanes.
1332
 
1332
 
1333
*Hmisc*
1333
*Hmisc*
1334
     Functions useful for data analysis, high-level graphics, utility
1334
     Functions useful for data analysis, high-level graphics, utility
1335
     operations, functions for computing sample size and power, importing
1335
     operations, functions for computing sample size and power, importing
1336
     datasets, imputing missing values, advanced table making, variable
1336
     datasets, imputing missing values, advanced table making, variable
1337
     clustering, character string manipulation, conversion of S objects to
1337
     clustering, character string manipulation, conversion of S objects to
1338
     LaTeX code, recoding variables, and bootstrap repeated measures
1338
     LaTeX code, recoding variables, and bootstrap repeated measures
1339
     analysis.
1339
     analysis.
1340
 
1340
 
1341
*HyperbolicDist*
1341
*HyperbolicDist*
1342
     Basic functions for the hyperbolic distribution: probability density
1342
     Basic functions for the hyperbolic distribution: probability density
1343
     function, distribution function, quantile function, a routine for
1343
     function, distribution function, quantile function, a routine for
1344
     generating observations from the hyperbolic, and a function for fitting
1344
     generating observations from the hyperbolic, and a function for fitting
1345
     the hyperbolic distribution to data.
1345
     the hyperbolic distribution to data.
1346
 
1346
 
1347
*ISwR*
1347
*ISwR*
1348
     Data sets for "Introductory Statistics with R" by Peter Dalgaard,
1348
     Data sets for "Introductory Statistics with R" by Peter Dalgaard,
1349
     2002, Springer.
1349
     2002, Springer.
1350
 
1350
 
1351
*KMsurv*
1351
*KMsurv*
1352
     Data sets and functions for "Survival Analysis, Techniques for Censored
1352
     Data sets and functions for "Survival Analysis, Techniques for Censored
1353
     and Truncated Data" by Klein and Moeschberger, 1997, Springer.
1353
     and Truncated Data" by Klein and Moeschberger, 1997, Springer.
1354
 
1354
 
1355
*KernSmooth*
1355
*KernSmooth*
1356
     Functions for kernel smoothing (and density estimation) corresponding
1356
     Functions for kernel smoothing (and density estimation) corresponding
1357
     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.
1358
     _Recommended_.
1358
     _Recommended_.
1359
 
1359
 
1360
*MASS*
1360
*MASS*
1361
     Functions and datasets from the main package of Venables and Ripley,
1361
     Functions and datasets from the main package of Venables and Ripley,
1362
     "Modern Applied Statistics with S".  Contained in the `VR' bundle.
1362
     "Modern Applied Statistics with S".  Contained in the `VR' bundle.
1363
     _Recommended_.
1363
     _Recommended_.
1364
 
1364
 
1365
*MCMCpack*
1365
*MCMCpack*
1366
     Markov chain Monte Carlo (MCMC) package: functions for posterior
1366
     Markov chain Monte Carlo (MCMC) package: functions for posterior
1367
     simulation for a number of statistical models.
1367
     simulation for a number of statistical models.
1368
 
1368
 
1369
*MPV*
1369
*MPV*
1370
     Data sets from the book "Introduction to Linear Regression Analysis"
1370
     Data sets from the book "Introduction to Linear Regression Analysis"
1371
     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
1372
     Sons.
1372
     Sons.
1373
 
1373
 
1374
*Matrix*
1374
*Matrix*
1375
     A Matrix package.
1375
     A Matrix package.
1376
 
1376
 
1377
*NISTnls*
1377
*NISTnls*
1378
     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.
1379
     National Institute for Standards and Technology.
1379
     National Institute for Standards and Technology.
1380
 
1380
 
1381
*Oarray*
1381
*Oarray*
1382
     Arrays with arbitrary offsets.
1382
     Arrays with arbitrary offsets.
1383
 
1383
 
1384
*PHYLOGR*
1384
*PHYLOGR*
1385
     Manipulation and analysis of phylogenetically simulated data sets (as
1385
     Manipulation and analysis of phylogenetically simulated data sets (as
1386
     obtained from PDSIMUL in package PDAP) and phylogenetically-based
1386
     obtained from PDSIMUL in package PDAP) and phylogenetically-based
1387
     analyses using GLS.
1387
     analyses using GLS.
1388
 
1388
 
1389
*PTAk*
1389
*PTAk*
1390
     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
1391
     generalisation of SVD also supporting non-identity metrics and
1391
     generalisation of SVD also supporting non-identity metrics and
1392
     penalisations.  Also includes some other multiway methods.
1392
     penalisations.  Also includes some other multiway methods.
1393
 
1393
 
1394
*R2HTML*
1394
*R2HTML*
1395
     Functions for exporting R objects & graphics in an HTML document.
1395
     Functions for exporting R objects & graphics in an HTML document.
1396
 
1396
 
1397
*R2WinBUGS*
1397
*R2WinBUGS*
1398
     Running WinBUGS from R: call a BUGS model, summarize inferences and
1398
     Running WinBUGS from R: call a BUGS model, summarize inferences and
1399
     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
1400
     for easy access in R.
1400
     for easy access in R.
1401
 
1401
 
1402
*RArcInfo*
1402
*RArcInfo*
1403
     Functions to import Arc/Info V7.x coverages and data.
1403
     Functions to import Arc/Info V7.x coverages and data.
1404
 
1404
 
1405
*RColorBrewer*
1405
*RColorBrewer*
1406
     ColorBrewer palettes for drawing nice maps shaded according to a
1406
     ColorBrewer palettes for drawing nice maps shaded according to a
1407
     variable.
1407
     variable.
1408
 
1408
 
1409
*RMySQL*
1409
*RMySQL*
1410
     An interface between R and the MySQL database system.
1410
     An interface between R and the MySQL database system.
1411
 
1411
 
1412
*RODBC*
1412
*RODBC*
1413
     An ODBC database interface.
1413
     An ODBC database interface.
1414
 
1414
 
1415
*ROracle*
1415
*ROracle*
1416
     Oracle Database Interface driver for R.  Uses the ProC/C++ embedded
1416
     Oracle Database Interface driver for R.  Uses the ProC/C++ embedded
1417
     SQL.
1417
     SQL.
1418
 
1418
 
1419
*RQuantLib*
1419
*RQuantLib*
1420
     Provides access to (some) of the QuantLib functions from within R;
1420
     Provides access to (some) of the QuantLib functions from within R;
1421
     currently limited to some Option pricing and analysis functions.  The
1421
     currently limited to some Option pricing and analysis functions.  The
1422
     QuantLib project aims to provide a comprehensive software framework for
1422
     QuantLib project aims to provide a comprehensive software framework for
1423
     quantitative finance.
1423
     quantitative finance.
1424
 
1424
 
1425
*RSQLite*
1425
*RSQLite*
1426
     Database Interface R driver for SQLite.  Embeds the SQLite database
1426
     Database Interface R driver for SQLite.  Embeds the SQLite database
1427
     engine in R.
1427
     engine in R.
1428
 
1428
 
1429
*RSvgDevice*
1429
*RSvgDevice*
1430
     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
1431
     Scalable Vector Graphics.
1431
     Scalable Vector Graphics.
1432
 
1432
 
1433
*RadioSonde*
1433
*RadioSonde*
1434
     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
1435
     and wind profiles for data collected by radiosondes (the typical
1435
     and wind profiles for data collected by radiosondes (the typical
1436
     weather balloon-borne instrument).
1436
     weather balloon-borne instrument).
1437
 
1437
 
1438
*RandomFields*
1438
*RandomFields*
1439
     Creating random fields using various methods.
1439
     Creating random fields using various methods.
1440
 
1440
 
1441
*Rcmdr*
1441
*Rcmdr*
1442
     A platform-independent basic-statistics GUI (graphical user interface)
1442
     A platform-independent basic-statistics GUI (graphical user interface)
1443
     for R, based on the *tcltk* package.
1443
     for R, based on the *tcltk* package.
1444
 
1444
 
1445
*RmSQL*
1445
*RmSQL*
1446
     An interface between R and the mSQL database system.
1446
     An interface between R and the mSQL database system.
1447
 
1447
 
1448
*Rwave*
1448
*Rwave*
1449
     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
1450
     especially for the wavelet and Gabor transforms of noisy signals),
1450
     especially for the wavelet and Gabor transforms of noisy signals),
1451
     based on the book "Practical Time-Frequency Analysis: Gabor and Wavelet
1451
     based on the book "Practical Time-Frequency Analysis: Gabor and Wavelet
1452
     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
1453
     and Bruno Torresani, 1998, Academic Press.
1453
     and Bruno Torresani, 1998, Academic Press.
1454
 
1454
 
1455
*SASmixed*
1455
*SASmixed*
1456
     Data sets and sample linear mixed effects analyses corresponding to the
1456
     Data sets and sample linear mixed effects analyses corresponding to the
1457
     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.
1458
     Milliken, W. W. Stroup and R. D. Wolfinger, 1996, SAS Institute.
1458
     Milliken, W. W. Stroup and R. D. Wolfinger, 1996, SAS Institute.
1459
 
1459
 
1460
*SenSrivastava*
1460
*SenSrivastava*
1461
     Collection of datasets from "Regression Analysis, Theory, Methods and
1461
     Collection of datasets from "Regression Analysis, Theory, Methods and
1462
     Applications" by A. Sen and M. Srivastava, 1990, Springer-Verlag.
1462
     Applications" by A. Sen and M. Srivastava, 1990, Springer-Verlag.
1463
 
1463
 
1464
*SoPhy*
1464
*SoPhy*
1465
     Soil Physics Tools: simulation of water flux and solute transport in
1465
     Soil Physics Tools: simulation of water flux and solute transport in
1466
     soil.
1466
     soil.
1467
 
1467
 
1468
*SparseM*
1468
*SparseM*
1469
     Basic linear algebra for sparse matrices.
1469
     Basic linear algebra for sparse matrices.
1470
 
1470
 
1471
*StatDataML*
1471
*StatDataML*
1472
     Read and write StatDataML.
1472
     Read and write StatDataML.
1473
 
1473
 
1474
*SuppDists*
1474
*SuppDists*
1475
     Ten distributions supplementing those built into R (Inverse Gauss,
1475
     Ten distributions supplementing those built into R (Inverse Gauss,
1476
     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,
1477
     maximum F ratio, the Pearson product moment correlation coefficiant,
1477
     maximum F ratio, the Pearson product moment correlation coefficiant,
1478
     Johnson distributions, normal scores and generalized hypergeometric
1478
     Johnson distributions, normal scores and generalized hypergeometric
1479
     distributions).
1479
     distributions).
1480
 
1480
 
1481
*VLMC*
1481
*VLMC*
1482
     Functions, classes & methods for estimation, prediction, and simulation
1482
     Functions, classes & methods for estimation, prediction, and simulation
1483
     (bootstrap) of VLMC (Variable Length Markov Chain) models.
1483
     (bootstrap) of VLMC (Variable Length Markov Chain) models.
1484
 
1484
 
1485
*VaR*
1485
*VaR*
1486
     Methods for calculation of Value at Risk (VaR).
1486
     Methods for calculation of Value at Risk (VaR).
1487
 
1487
 
1488
*XML*
1488
*XML*
1489
     Facilities for reading XML documents and DTDs.
1489
     Facilities for reading XML documents and DTDs.
1490
 
1490
 
1491
*abind*
1491
*abind*
1492
     Combine multi-dimensional arrays.
1492
     Combine multi-dimensional arrays.
1493
 
1493
 
1494
*acepack*
1494
*acepack*
1495
     ACE (Alternating Conditional Expectations) and AVAS (Additivity and
1495
     ACE (Alternating Conditional Expectations) and AVAS (Additivity and
1496
     VAriance Stabilization for regression) methods for selecting regression
1496
     VAriance Stabilization for regression) methods for selecting regression
1497
     transformations.
1497
     transformations.
1498
 
1498
 
1499
*adapt*
1499
*adapt*
1500
     Adaptive quadrature in up to 20 dimensions.
1500
     Adaptive quadrature in up to 20 dimensions.
1501
 
1501
 
1502
*ade4*
1502
*ade4*
1503
     Multivariate data analysis and graphical display.
1503
     Multivariate data analysis and graphical display.
1504
 
1504
 
1505
*agce*
1505
*agce*
1506
     Analysis of growth curve experiments.
1506
     Analysis of growth curve experiments.
1507
 
1507
 
1508
*akima*
1508
*akima*
1509
     Linear or cubic spline interpolation for irregularly gridded data.
1509
     Linear or cubic spline interpolation for irregularly gridded data.
1510
 
1510
 
1511
*amap*
1511
*amap*
1512
     Another Multidimensional Analysis Package.
1512
     Another Multidimensional Analysis Package.
1513
 
1513
 
1514
*anm*
1514
*anm*
1515
     Analog model for statistical/empirical downscaling.
1515
     Analog model for statistical/empirical downscaling.
1516
 
1516
 
1517
*ape*
1517
*ape*
1518
     Analyses of Phylogenetics and Evolution, providing functions for
1518
     Analyses of Phylogenetics and Evolution, providing functions for
1519
     reading and plotting phylogenetic trees in parenthetic format
1519
     reading and plotting phylogenetic trees in parenthetic format
1520
     (standard Newick format), analyses of comparative data in a
1520
     (standard Newick format), analyses of comparative data in a
1521
     phylogenetic framework, analyses of diversification and
1521
     phylogenetic framework, analyses of diversification and
1522
     macroevolution, computing distances from allelic and nucleotide data,
1522
     macroevolution, computing distances from allelic and nucleotide data,
1523
     reading nucleotide sequences from GenBank via internet, and several
1523
     reading nucleotide sequences from GenBank via internet, and several
1524
     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
1525
     the population parameter theta based on various approaches.
1525
     the population parameter theta based on various approaches.
1526
 
1526
 
1527
*ash*
1527
*ash*
1528
     David Scott's ASH routines for 1D and 2D density estimation.
1528
     David Scott's ASH routines for 1D and 2D density estimation.
1529
 
1529
 
1530
*assist*
1530
*assist*
1531
     A suite of functions implementing smoothing splines.
1531
     A suite of functions implementing smoothing splines.
1532
 
1532
 
1533
*asypow*
1533
*asypow*
1534
     A set of routines that calculate power and related quantities utilizing
1534
     A set of routines that calculate power and related quantities utilizing
1535
     asymptotic likelihood ratio methods.
1535
     asymptotic likelihood ratio methods.
1536
 
1536
 
1537
*aws*
1537
*aws*
1538
     Functions to perform adaptive weights smoothing.
1538
     Functions to perform adaptive weights smoothing.
1539
 
1539
 
1540
*bim*
1540
*bim*
1541
     Bayesian interval mapping diagnostics:  functions to interpret QTLCart
1541
     Bayesian interval mapping diagnostics:  functions to interpret QTLCart
1542
     and Bmapqtl samples.
1542
     and Bmapqtl samples.
1543
 
1543
 
1544
*bindata*
1544
*bindata*
1545
     Generation of correlated artificial binary data.
1545
     Generation of correlated artificial binary data.
1546
 
1546
 
1547
*blighty*
1547
*blighty*
1548
     Function for drawing the coastline of the United Kingdom.
1548
     Function for drawing the coastline of the United Kingdom.
1549
 
1549
 
1550
*boolean*
1550
*boolean*
1551
     Boolean logit and probit: a procedure for testing Boolean hypotheses.
1551
     Boolean logit and probit: a procedure for testing Boolean hypotheses.
1552
 
1552
 
1553
*boot*
1553
*boot*
1554
     Functions and datasets for bootstrapping from the book "Bootstrap
1554
     Functions and datasets for bootstrapping from the book "Bootstrap
1555
     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,
1556
     1997, Cambridge University Press.  _Recommended_.
1556
     1997, Cambridge University Press.  _Recommended_.
1557
 
1557
 
1558
*bootstrap*
1558
*bootstrap*
1559
     Software (bootstrap, cross-validation, jackknife), data and errata for
1559
     Software (bootstrap, cross-validation, jackknife), data and errata for
1560
     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.
1561
     Tibshirani, 1993, Chapman and Hall.
1561
     Tibshirani, 1993, Chapman and Hall.
1562
 
1562
 
1563
*bqtl*
1563
*bqtl*
1564
     QTL mapping toolkit for inbred crosses and recombinant inbred lines.
1564
     QTL mapping toolkit for inbred crosses and recombinant inbred lines.
1565
     Includes maximum likelihood and Bayesian tools.
1565
     Includes maximum likelihood and Bayesian tools.
1566
 
1566
 
1567
*brlr*
1567
*brlr*
1568
     Bias-reduced logistic regression: fits logistic regression models by
1568
     Bias-reduced logistic regression: fits logistic regression models by
1569
     maximum penalized likelihood.
1569
     maximum penalized likelihood.
1570
 
1570
 
1571
*car*
1571
*car*
1572
     Companion to Applied Regression, containing functions for applied
1572
     Companion to Applied Regression, containing functions for applied
1573
     regession, linear models, and generalized linear models, with an
1573
     regession, linear models, and generalized linear models, with an
1574
     emphasis on regression diagnostics, particularly graphical diagnostic
1574
     emphasis on regression diagnostics, particularly graphical diagnostic
1575
     methods.
1575
     methods.
1576
 
1576
 
1577
*cat*
1577
*cat*
1578
     Analysis of categorical-variable datasets with missing values.
1578
     Analysis of categorical-variable datasets with missing values.
1579
 
1579
 
1580
*cclust*
1580
*cclust*
1581
     Convex clustering methods, including k-means algorithm, on-line update
1581
     Convex clustering methods, including k-means algorithm, on-line update
1582
     algorithm (Hard Competitive Learning) and Neural Gas algorithm (Soft
1582
     algorithm (Hard Competitive Learning) and Neural Gas algorithm (Soft
1583
     Competitive Learning) and calculation of several indexes for finding
1583
     Competitive Learning) and calculation of several indexes for finding
1584
     the number of clusters in a data set.
1584
     the number of clusters in a data set.
1585
 
1585
 
1586
*cfa*
1586
*cfa*
1587
     Analysis of configuration frequencies.
1587
     Analysis of configuration frequencies.
1588
 
1588
 
1589
*chron*
1589
*chron*
1590
     A package for working with chronological objects (times and dates).
1590
     A package for working with chronological objects (times and dates).
1591
 
1591
 
1592
*class*
1592
*class*
1593
     Functions for classification (k-nearest neighbor and LVQ).  Contained
1593
     Functions for classification (k-nearest neighbor and LVQ).  Contained
1594
     in the `VR' bundle.  _Recommended_.
1594
     in the `VR' bundle.  _Recommended_.
1595
 
1595
 
1596
*classPP*
1596
*classPP*
1597
     Projection Pursuit for supervised classification.
1597
     Projection Pursuit for supervised classification.
1598
 
1598
 
1599
*clim.pact*
1599
*clim.pact*
1600
     Climate analysis and downscaling for monthly and daily data.
1600
     Climate analysis and downscaling for monthly and daily data.
1601
 
1601
 
1602
*clines*
1602
*clines*
1603
     Calculates Contour Lines.
1603
     Calculates Contour Lines.
1604
 
1604
 
1605
*cluster*
1605
*cluster*
1606
     Functions for cluster analysis.  _Recommended_.
1606
     Functions for cluster analysis.  _Recommended_.
1607
 
1607
 
1608
*cmprsk*
1608
*cmprsk*
1609
     Estimation, testing and regression modeling of subdistribution
1609
     Estimation, testing and regression modeling of subdistribution
1610
     functions in competing risks.
1610
     functions in competing risks.
1611
 
1611
 
1612
*cobs*
1612
*cobs*
1613
     Constrained B-splines: qualitatively constrained (regression) smoothing
1613
     Constrained B-splines: qualitatively constrained (regression) smoothing
1614
     via linear programming.
1614
     via linear programming.
1615
 
1615
 
1616
*coda*
1616
*coda*
1617
     Output analysis and diagnostics for Markov Chain Monte Carlo (MCMC)
1617
     Output analysis and diagnostics for Markov Chain Monte Carlo (MCMC)
1618
     simulations.
1618
     simulations.
1619
 
1619
 
1620
*combinat*
1620
*combinat*
1621
     Combinatorics utilities.
1621
     Combinatorics utilities.
1622
 
1622
 
1623
*concord*
1623
*concord*
1624
     Measures of concordance and reliability.
1624
     Measures of concordance and reliability.
1625
 
1625
 
1626
*conf.design*
1626
*conf.design*
1627
     A series of simple tools for constructing and manipulating confounded
1627
     A series of simple tools for constructing and manipulating confounded
1628
     and fractional factorial designs.
1628
     and fractional factorial designs.
1629
 
1629
 
1630
*covRobust*
1630
*covRobust*
1631
     Robust covariance estimation via nearest neighbor cleaning.
1631
     Robust covariance estimation via nearest neighbor cleaning.
1632
 
1632
 
1633
*cramer*
1633
*cramer*
1634
     Routine for the multivariate nonparametric Cramer test.
1634
     Routine for the multivariate nonparametric Cramer test.
1635
 
1635
 
1636
*date*
1636
*date*
1637
     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
1638
     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
1639
     August 1953', ..., `August 30 53', or any mixture of these.
1639
     August 1953', ..., `August 30 53', or any mixture of these.
1640
 
1640
 
1641
*dblcens*
1641
*dblcens*
1642
     Calculates the NPMLE of the survival distribution for doubly censored
1642
     Calculates the NPMLE of the survival distribution for doubly censored
1643
     data.
1643
     data.
1644
 
1644
 
1645
*deal*
1645
*deal*
1646
     Bayesian networks with continuous and/or discrete variables can be
1646
     Bayesian networks with continuous and/or discrete variables can be
1647
     learned and compared from data.
1647
     learned and compared from data.
1648
 
1648
 
1649
*debug*
1649
*debug*
1650
     Debugger for R functions, with code display, graceful error recovery,
1650
     Debugger for R functions, with code display, graceful error recovery,
1651
     line-numbered conditional breakpoints, access to exit code, flow
1651
     line-numbered conditional breakpoints, access to exit code, flow
1652
     control, and full keyboard input.
1652
     control, and full keyboard input.
1653
 
1653
 
1654
*deldir*
1654
*deldir*
1655
     Calculates the  Delaunay triangulation and the Dirichlet or Voronoi
1655
     Calculates the  Delaunay triangulation and the Dirichlet or Voronoi
1656
     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.
1657
 
1657
 
1658
*diamonds*
1658
*diamonds*
1659
     Functions for illustrating aperture-4 diamond partitions in the plane,
1659
     Functions for illustrating aperture-4 diamond partitions in the plane,
1660
     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
1661
     or sampling grids.
1661
     or sampling grids.
1662
 
1662
 
1663
*dichromat*
1663
*dichromat*
1664
     Color schemes for dichromats: collapse red-green distinctions to
1664
     Color schemes for dichromats: collapse red-green distinctions to
1665
     simulate the effects of colour-blindness.
1665
     simulate the effects of colour-blindness.
1666
 
1666
 
1667
*digest*
1667
*digest*
1668
     Two functions for the creation of "hash" digests of arbitrary R
1668
     Two functions for the creation of "hash" digests of arbitrary R
1669
     objects using the md5 and sha-1 algorithms permitting easy comparison
1669
     objects using the md5 and sha-1 algorithms permitting easy comparison
1670
     of R language objects.
1670
     of R language objects.
1671
 
1671
 
1672
*diptest*
1672
*diptest*
1673
     Compute Hartigan's dip test statistic for unimodality.
1673
     Compute Hartigan's dip test statistic for unimodality.
1674
 
1674
 
1675
*dispmod*
1675
*dispmod*
1676
     Functions for modelling dispersion in GLMs.
1676
     Functions for modelling dispersion in GLMs.
1677
 
1677
 
1678
*dr*
1678
*dr*
1679
     Functions, methods, and datasets for fitting dimension reduction
1679
     Functions, methods, and datasets for fitting dimension reduction
1680
     regression, including pHd and inverse regression methods SIR and SAVE.
1680
     regression, including pHd and inverse regression methods SIR and SAVE.
1681
 
1681
 
1682
*dse*
1682
*dse*
1683
     Dynamic System Estimation, a multivariate time series package.
1683
     Dynamic System Estimation, a multivariate time series package.
1684
     Contains *dse1* (the base system, including multivariate ARMA and state
1684
     Contains *dse1* (the base system, including multivariate ARMA and state
1685
     space models), *dse2* (extensions for evaluating estimation
1685
     space models), *dse2* (extensions for evaluating estimation
1686
     techniques, forecasting, and for evaluating forecasting model),
1686
     techniques, forecasting, and for evaluating forecasting model),
1687
     *tframe* (functions for writing code that is independent of the
1687
     *tframe* (functions for writing code that is independent of the
1688
     representation of time). and *setRNG* (a mechanism for generating the
1688
     representation of time). and *setRNG* (a mechanism for generating the
1689
     same random numbers in S and R).
1689
     same random numbers in S and R).
1690
 
1690
 
1691
*dynamicGraph*
1691
*dynamicGraph*
1692
     Interactive graphical tool for manipulating graphs.
1692
     Interactive graphical tool for manipulating graphs.
1693
 
1693
 
1694
*e1071*
1694
*e1071*
1695
     Miscellaneous functions used at the Department of Statistics at TU Wien
1695
     Miscellaneous functions used at the Department of Statistics at TU Wien
1696
     (E1071), including moments, short-time Fourier transforms, Independent
1696
     (E1071), including moments, short-time Fourier transforms, Independent
1697
     Component Analysis, Latent Class Analysis, support vector machines, and
1697
     Component Analysis, Latent Class Analysis, support vector machines, and
1698
     fuzzy clustering, shortest path computation, bagged clustering, and
1698
     fuzzy clustering, shortest path computation, bagged clustering, and
1699
     some more.
1699
     some more.
1700
 
1700
 
1701
*effects*
1701
*effects*
1702
     Graphical and tabular effect displays, e.g., of interactions, for
1702
     Graphical and tabular effect displays, e.g., of interactions, for
1703
     linear and generalised linear models.
1703
     linear and generalised linear models.
1704
 
1704
 
1705
*eha*
1705
*eha*
1706
     A package for survival and event history analysis.
1706
     A package for survival and event history analysis.
1707
 
1707
 
1708
*ellipse*
1708
*ellipse*
1709
     Package for drawing ellipses and ellipse-like confidence regions.
1709
     Package for drawing ellipses and ellipse-like confidence regions.
1710
 
1710
 
1711
*emme2*
1711
*emme2*
1712
     Functions to read from and write to an EMME/2 databank.
1712
     Functions to read from and write to an EMME/2 databank.
1713
 
1713
 
1714
*emplik*
1714
*emplik*
1715
     Empirical likelihood ratio for means/quantiles/hazards from possibly
1715
     Empirical likelihood ratio for means/quantiles/hazards from possibly
1716
     right censored data.
1716
     right censored data.
1717
 
1717
 
1718
*energy*
1718
*energy*
1719
     E-statistics (energy) tests for comparing distributions: multivariate
1719
     E-statistics (energy) tests for comparing distributions: multivariate
1720
     normality, Poisson test, multivariate k-sample test for equal
1720
     normality, Poisson test, multivariate k-sample test for equal
1721
     distributions, hierarchical clustering by e-distances.
1721
     distributions, hierarchical clustering by e-distances.
1722
 
1722
 
1723
*evd*
1723
*evd*
1724
     Functions for extreme value distributions.  Extends simulation,
1724
     Functions for extreme value distributions.  Extends simulation,
1725
     distribution, quantile and density functions to univariate, bivariate
1725
     distribution, quantile and density functions to univariate, bivariate
1726
     and (for simulation) multivariate parametric extreme value
1726
     and (for simulation) multivariate parametric extreme value
1727
     distributions, and provides fitting functions which calculate maximum
1727
     distributions, and provides fitting functions which calculate maximum
1728
     likelihood estimates for univariate and bivariate models.
1728
     likelihood estimates for univariate and bivariate models.
1729
 
1729
 
1730
*exactLoglinTest*
1730
*exactLoglinTest*
1731
     Monte Carlo exact tests for log-linear models.
1731
     Monte Carlo exact tests for log-linear models.
1732
 
1732
 
1733
*exactRankTests*
1733
*exactRankTests*
1734
     Computes exact p-values and quantiles using an implementation of the
1734
     Computes exact p-values and quantiles using an implementation of the
1735
     Streitberg/Roehmel shift algorithm.
1735
     Streitberg/Roehmel shift algorithm.
1736
 
1736
 
1737
*fastICA*
1737
*fastICA*
1738
     Implementation of FastICA algorithm to perform Independent Component
1738
     Implementation of FastICA algorithm to perform Independent Component
1739
     Analysis (ICA) and Projection Pursuit.
1739
     Analysis (ICA) and Projection Pursuit.
1740
 
1740
 
1741
*fda*
1741
*fda*
1742
     Functional Data Analysis: analysis of data where the basic observation
1742
     Functional Data Analysis: analysis of data where the basic observation
1743
     is a function of some sort.
1743
     is a function of some sort.
1744
 
1744
 
1745
*fdim*
1745
*fdim*
1746
     Functions for calculating fractal dimension.
1746
     Functions for calculating fractal dimension.
1747
 
1747
 
1748
*fields*
1748
*fields*
1749
     A collection of programs for curve and function fitting with an
1749
     A collection of programs for curve and function fitting with an
1750
     emphasis on spatial data.  The major methods implemented include cubic
1750
     emphasis on spatial data.  The major methods implemented include cubic
1751
     and thin plate splines, universal Kriging and Kriging for large data
1751
     and thin plate splines, universal Kriging and Kriging for large data
1752
     sets.  The main feature is that any covariance function implemented in
1752
     sets.  The main feature is that any covariance function implemented in
1753
     R can be used for spatial prediction.
1753
     R can be used for spatial prediction.
1754
 
1754
 
1755
*flexmix*
1755
*flexmix*
1756
     Flexible Mixture Modeling: a general framework for finite mixtures of
1756
     Flexible Mixture Modeling: a general framework for finite mixtures of
1757
     regression models using the EM algorithm.
1757
     regression models using the EM algorithm.
1758
 
1758
 
1759
*foreign*
1759
*foreign*
1760
     Functions for reading and writing data stored by statistical software
1760
     Functions for reading and writing data stored by statistical software
1761
     like Minitab, SAS, SPSS, Stata, etc.  _Recommended_.
1761
     like Minitab, SAS, SPSS, Stata, etc.  _Recommended_.
1762
 
1762
 
1763
*fork*
1763
*fork*
1764
     Functions for handling multiple processes: simple wrappers around the
1764
     Functions for handling multiple processes: simple wrappers around the
1765
     Unix process management API calls.
1765
     Unix process management API calls.
1766
 
1766
 
1767
*forward*
1767
*forward*
1768
     Forward search approach to robust analysis in linear and generalized
1768
     Forward search approach to robust analysis in linear and generalized
1769
     linear regression models.
1769
     linear regression models.
1770
 
1770
 
1771
*fpc*
1771
*fpc*
1772
     Fixed point clusters, clusterwise regression and discriminant plots.
1772
     Fixed point clusters, clusterwise regression and discriminant plots.
1773
 
1773
 
1774
*fracdiff*
1774
*fracdiff*
1775
     Maximum likelihood estimation of the parameters of a fractionally
1775
     Maximum likelihood estimation of the parameters of a fractionally
1776
     differenced ARIMA(p,d,q) model (Haslett and Raftery, Applied
1776
     differenced ARIMA(p,d,q) model (Haslett and Raftery, Applied
1777
     Statistics, 1989).
1777
     Statistics, 1989).
1778
 
1778
 
1779
*ftnonpar*
1779
*ftnonpar*
1780
     Features and strings for nonparametric regression.
1780
     Features and strings for nonparametric regression.
1781
 
1781
 
1782
*g.data*
1782
*g.data*
1783
     Create and maintain delayed-data packages (DDP's).
1783
     Create and maintain delayed-data packages (DDP's).
1784
 
1784
 
1785
*gafit*
1785
*gafit*
1786
     Genetic algorithm for curve fitting.
1786
     Genetic algorithm for curve fitting.
1787
 
1787
 
1788
*gap*
1788
*gap*
1789
     Genetic analysis package for both population and family data.
1789
     Genetic analysis package for both population and family data.
1790
 
1790
 
1791
*gbm*
1791
*gbm*
1792
     Generalized Boosted Regression Models: implements extensions to Freund
1792
     Generalized Boosted Regression Models: implements extensions to Freund
1793
     and Schapire's AdaBoost algorithm and J. Friedman's gradient boosting
1793
     and Schapire's AdaBoost algorithm and J. Friedman's gradient boosting
1794
     machine.  Includes regression methods for least squares, absolute loss,
1794
     machine.  Includes regression methods for least squares, absolute loss,
1795
     logistic, Poisson, Cox proportional hazards partial likelihood, and
1795
     logistic, Poisson, Cox proportional hazards partial likelihood, and
1796
     AdaBoost exponential loss.
1796
     AdaBoost exponential loss.
1797
 
1797
 
1798
*gclus*
1798
*gclus*
1799
     Clustering Graphics.  Orders panels in scatterplot matrices and
1799
     Clustering Graphics.  Orders panels in scatterplot matrices and
1800
     parallel coordinate displays by some merit index.
1800
     parallel coordinate displays by some merit index.
1801
 
1801
 
1802
*gee*
1802
*gee*
1803
     An implementation of the Liang/Zeger generalized estimating equation
1803
     An implementation of the Liang/Zeger generalized estimating equation
1804
     approach to GLMs for dependent data.
1804
     approach to GLMs for dependent data.
1805
 
1805
 
1806
*geepack*
1806
*geepack*
1807
     Generalized estimating equations solver for parameters in mean, scale,
1807
     Generalized estimating equations solver for parameters in mean, scale,
1808
     and correlation structures, through mean link, scale link, and
1808
     and correlation structures, through mean link, scale link, and
1809
     correlation link.  Can also handle clustered categorical responses.
1809
     correlation link.  Can also handle clustered categorical responses.
1810
 
1810
 
1811
*genetics*
1811
*genetics*
1812
     Classes and methods for handling genetic data.  Includes classes to
1812
     Classes and methods for handling genetic data.  Includes classes to
1813
     represent genotypes and haplotypes at single markers up to multiple
1813
     represent genotypes and haplotypes at single markers up to multiple
1814
     markers on multiple chromosomes, and functions for allele frequencies,
1814
     markers on multiple chromosomes, and functions for allele frequencies,
1815
     flagging homo/heterozygotes, flagging carriers of certain alleles,
1815
     flagging homo/heterozygotes, flagging carriers of certain alleles,
1816
     computing disequlibrium, testing Hardy-Weinberg equilibrium, ...
1816
     computing disequlibrium, testing Hardy-Weinberg equilibrium, ...
1817
 
1817
 
1818
*geoR*
1818
*geoR*
1819
     Functions to perform geostatistical data analysis including model-based
1819
     Functions to perform geostatistical data analysis including model-based
1820
     methods.
1820
     methods.
1821
 
1821
 
1822
*geoRglm*
1822
*geoRglm*
1823
     Functions for inference in generalised linear spatial models.
1823
     Functions for inference in generalised linear spatial models.
1824
 
1824
 
1825
*ggm*
1825
*ggm*
1826
     Functions for defining directed acyclic graphs and undirected graphs,
1826
     Functions for defining directed acyclic graphs and undirected graphs,
1827
     finding induced graphs and fitting Gaussian Markov models.
1827
     finding induced graphs and fitting Gaussian Markov models.
1828
 
1828
 
1829
*gld*
1829
*gld*
1830
     Basic functions for the generalised (Tukey) lambda distribution.
1830
     Basic functions for the generalised (Tukey) lambda distribution.
1831
 
1831
 
1832
*gllm*
1832
*gllm*
1833
     Routines for log-linear models of incomplete contingency tables,
1833
     Routines for log-linear models of incomplete contingency tables,
1834
     including some latent class models via EM and Fisher scoring
1834
     including some latent class models via EM and Fisher scoring
1835
     approaches.
1835
     approaches.
1836
 
1836
 
1837
*glmmML*
1837
*glmmML*
1838
     A Maximum Likelihood approach to generalized linear models with random
1838
     A Maximum Likelihood approach to generalized linear models with random
1839
     intercept.
1839
     intercept.
1840
 
1840
 
1841
*gpclib*
1841
*gpclib*
1842
     General polygon clipping routines for R based on Alan Murta's C
1842
     General polygon clipping routines for R based on Alan Murta's C
1843
     library.
1843
     library.
1844
 
1844
 
1845
*grasper*
1845
*grasper*
1846
     Generalized Regression Analysis and Spatial Predictions for R.
1846
     Generalized Regression Analysis and Spatial Predictions for R.
1847
 
1847
 
1848
*gregmisc*
1848
*gregmisc*
1849
     Miscellaneous functions written/maintained by Gregory R. Warnes.
1849
     Miscellaneous functions written/maintained by Gregory R. Warnes.
1850
 
1850
 
1851
*gridBase*
1851
*gridBase*
1852
     Integration of base and grid graphics.
1852
     Integration of base and grid graphics.
1853
 
1853
 
1854
*gss*
1854
*gss*
1855
     A comprehensive package for structural multivariate function estimation
1855
     A comprehensive package for structural multivariate function estimation
1856
     using smoothing splines.
1856
     using smoothing splines.
1857
 
1857
 
1858
*gstat*
1858
*gstat*
1859
     multivariable geostatistical modelling, prediction and simulation.
1859
     multivariable geostatistical modelling, prediction and simulation.
1860
     Includes code for variogram modelling; simple, ordinary and universal
1860
     Includes code for variogram modelling; simple, ordinary and universal
1861
     point or block (co)kriging, sequential Gaussian or indicator
1861
     point or block (co)kriging, sequential Gaussian or indicator
1862
     (co)simulation, and map plotting functions.
1862
     (co)simulation, and map plotting functions.
1863
 
1863
 
1864
*gtkDevice*
1864
*gtkDevice*
1865
     GTK graphics device driver that may be used independently of the
1865
     GTK graphics device driver that may be used independently of the
1866
     R-GNOME interface and can be used to create R devices as embedded
1866
     R-GNOME interface and can be used to create R devices as embedded
1867
     components in a GUI using a Gtk drawing area widget, e.g., using RGtk.
1867
     components in a GUI using a Gtk drawing area widget, e.g., using RGtk.
1868
 
1868
 
1869
*hapassoc*
1869
*hapassoc*
1870
     Likelihood inference of trait associations with SNP haplotypes and
1870
     Likelihood inference of trait associations with SNP haplotypes and
1871
     other attributes using the EM Algorithm.
1871
     other attributes using the EM Algorithm.
1872
 
1872
 
1873
*haplo.score*
1873
*haplo.score*
1874
     Score tests for association of traits with haplotypes when linkage
1874
     Score tests for association of traits with haplotypes when linkage
1875
     phase is ambiguous.
1875
     phase is ambiguous.
1876
 
1876
 
1877
*hdf5*
1877
*hdf5*
1878
     Interface to the NCSA HDF5 library.
1878
     Interface to the NCSA HDF5 library.
1879
 
1879
 
1880
*hett*
1880
*hett*
1881
     Functions for the fitting and summarizing of heteroscedastic
1881
     Functions for the fitting and summarizing of heteroscedastic
1882
     t-regression.
1882
     t-regression.
1883
 
1883
 
1884
*hier.part*
1884
*hier.part*
1885
     Hierarchical Partitioning: variance partition of a multivariate data
1885
     Hierarchical Partitioning: variance partition of a multivariate data
1886
     set.
1886
     set.
1887
 
1887
 
1888
*homals*
1888
*homals*
1889
     Homogeneity Analysis (HOMALS) package with optional Tcl/Tk interface.
1889
     Homogeneity Analysis (HOMALS) package with optional Tcl/Tk interface.
1890
 
1890
 
1891
*hwde*
1891
*hwde*
1892
     Models and tests for departure from Hardy-Weinberg equilibrium and
1892
     Models and tests for departure from Hardy-Weinberg equilibrium and
1893
     independence between loci.
1893
     independence between loci.
1894
 
1894
 
1895
*ifs*
1895
*ifs*
1896
     Iterated Function Systems distribution function estimator.
1896
     Iterated Function Systems distribution function estimator.
1897
 
1897
 
1898
*impute*
1898
*impute*
1899
     Imputation for microarray data (currently KNN only).
1899
     Imputation for microarray data (currently KNN only).
1900
 
1900
 
1901
*ineq*
1901
*ineq*
1902
     Inequality, concentration and poverty measures, and Lorenz curves
1902
     Inequality, concentration and poverty measures, and Lorenz curves
1903
     (empirical and theoretic).
1903
     (empirical and theoretic).
1904
 
1904
 
1905
*ipred*
1905
*ipred*
1906
     Improved predictive models by direct and indirect bootstrap aggregation
1906
     Improved predictive models by direct and indirect bootstrap aggregation
1907
     in classification and regression as well as resampling based estimators
1907
     in classification and regression as well as resampling based estimators
1908
     of prediction error.
1908
     of prediction error.
1909
 
1909
 
1910
*ismev*
1910
*ismev*
1911
     Functions to support the computations carried out in "An Introduction
1911
     Functions to support the computations carried out in "An Introduction
1912
     to Statistical Modeling of Extreme Values;' by S. Coles, 2001,
1912
     to Statistical Modeling of Extreme Values;' by S. Coles, 2001,
1913
     Springer.  The functions may be divided into the following groups;
1913
     Springer.  The functions may be divided into the following groups;
1914
     maxima/minima, order statistics, peaks over thresholds and point
1914
     maxima/minima, order statistics, peaks over thresholds and point
1915
     processes.
1915
     processes.
1916
 
1916
 
1917
*its*
1917
*its*
1918
     An S4 class for handling irregular time series.
1918
     An S4 class for handling irregular time series.
1919
 
1919
 
1920
*kernlab*
1920
*kernlab*
1921
     Kernel-based machine learning methods including support vector
1921
     Kernel-based machine learning methods including support vector
1922
     machines.  (Currently in `1.9.0/Other'.)
1922
     machines.  (Currently in `1.9.0/Other'.)
1923
 
1923
 
1924
*knnTree*
1924
*knnTree*
1925
     Construct or predict with k-nearest-neighbor classifiers, using
1925
     Construct or predict with k-nearest-neighbor classifiers, using
1926
     cross-validation to select k, choose variables (by forward or
1926
     cross-validation to select k, choose variables (by forward or
1927
     backwards selection), and choose scaling (from among no scaling,
1927
     backwards selection), and choose scaling (from among no scaling,
1928
     scaling each column by its SD, or scaling each column by its MAD).
1928
     scaling each column by its SD, or scaling each column by its MAD).
1929
     The finished classifier will consist of a classification tree with one
1929
     The finished classifier will consist of a classification tree with one
1930
     such k-nn classifier in each leaf.
1930
     such k-nn classifier in each leaf.
1931
 
1931
 
1932
*labstatR*
1932
*labstatR*
1933
     Functions for the book "Laboratorio di statistica con R" by S. M.
1933
     Functions for the book "Laboratorio di statistica con R" by S. M.
1934
     Iacus and G. Masarotto, 2002, McGraw-Hill.  Function names and
1934
     Iacus and G. Masarotto, 2002, McGraw-Hill.  Function names and
1935
     documentation in Italian.
1935
     documentation in Italian.
1936
 
1936
 
1937
*lars*
1937
*lars*
1938
     Least Angle Regression, Lasso and Forward Stagewise: efficient
1938
     Least Angle Regression, Lasso and Forward Stagewise: efficient
1939
     procedures for fitting an entire lasso sequence with the cost of a
1939
     procedures for fitting an entire lasso sequence with the cost of a
1940
     single least squares fit.
1940
     single least squares fit.
1941
 
1941
 
1942
*lasso2*
1942
*lasso2*
1943
     Routines and documentation for solving regression problems while
1943
     Routines and documentation for solving regression problems while
1944
     imposing an L1 constraint on the estimates, based on the algorithm of
1944
     imposing an L1 constraint on the estimates, based on the algorithm of
1945
     Osborne et al. (1998)
1945
     Osborne et al. (1998)
1946
 
1946
 
1947
*lattice*
1947
*lattice*
1948
     Lattice graphics, an implementation of Trellis Graphics functions.
1948
     Lattice graphics, an implementation of Trellis Graphics functions.
1949
     _Recommended_.
1949
     _Recommended_.
1950
 
1950
 
1951
*lazy*
1951
*lazy*
1952
     Lazy learning for local regression.
1952
     Lazy learning for local regression.
1953
 
1953
 
1954
*ldDesign*
1954
*ldDesign*
1955
     Design of experiments for detection of linkage disequilibrium,
1955
     Design of experiments for detection of linkage disequilibrium,
1956
 
1956
 
1957
*leaps*
1957
*leaps*
1958
     A package which performs an exhaustive search for the best subsets of a
1958
     A package which performs an exhaustive search for the best subsets of a
1959
     given set of potential regressors, using a branch-and-bound algorithm,
1959
     given set of potential regressors, using a branch-and-bound algorithm,
1960
     and also performs searches using a number of less time-consuming
1960
     and also performs searches using a number of less time-consuming
1961
     techniques.
1961
     techniques.
1962
 
1962
 
1963
*lgtdl*
1963
*lgtdl*
1964
     A set of methods for longitudinal data objects.
1964
     A set of methods for longitudinal data objects.
1965
 
1965
 
1966
*linprog*
1966
*linprog*
1967
     Solve linear programming/linear optimization problems by using the
1967
     Solve linear programming/linear optimization problems by using the
1968
     simplex algorithm.
1968
     simplex algorithm.
1969
 
1969
 
1970
*lme4*
1970
*lme4*
1971
     Fit linear and generalized linear mixed-effects models.
1971
     Fit linear and generalized linear mixed-effects models.
1972
 
1972
 
1973
*lmeSplines*
1973
*lmeSplines*
1974
     Fit smoothing spline terms in Gaussian linear and nonlinear
1974
     Fit smoothing spline terms in Gaussian linear and nonlinear
1975
     mixed-effects models.
1975
     mixed-effects models.
1976
 
1976
 
1977
*lmm*
1977
*lmm*
1978
     Linear mixed models.
1978
     Linear mixed models.
1979
 
1979
 
1980
*lmtest*
1980
*lmtest*
1981
     A collection of tests on the assumptions of linear regression models
1981
     A collection of tests on the assumptions of linear regression models
1982
     from the book "The linear regression model under test" by W. Kraemer
1982
     from the book "The linear regression model under test" by W. Kraemer
1983
     and H. Sonnberger, 1986, Physica.
1983
     and H. Sonnberger, 1986, Physica.
1984
 
1984
 
1985
*locfit*
1985
*locfit*
1986
     Local Regression, likelihood and density estimation.
1986
     Local Regression, likelihood and density estimation.
1987
 
1987
 
1988
*logistf*
1988
*logistf*
1989
     Firth's bias reduced logistic regression approach with penalized
1989
     Firth's bias reduced logistic regression approach with penalized
1990
     profile likelihood based confidence intervals for parameter estimates.
1990
     profile likelihood based confidence intervals for parameter estimates.
1991
 
1991
 
1992
*logspline*
1992
*logspline*
1993
     Logspline density estimation.
1993
     Logspline density estimation.
1994
 
1994
 
1995
*lokern*
1995
*lokern*
1996
     Kernel regression smoothing with adaptive local or global plug-in
1996
     Kernel regression smoothing with adaptive local or global plug-in
1997
     bandwidth selection.
1997
     bandwidth selection.
1998
 
1998
 
1999
*lpSolve*
1999
*lpSolve*
2000
     Functions that solve general linear/integer problems, assignment
2000
     Functions that solve general linear/integer problems, assignment
2001
     problems, and transportation problems via interfacing Lp_solve.
2001
     problems, and transportation problems via interfacing Lp_solve.
2002
 
2002
 
2003
*lpridge*
2003
*lpridge*
2004
     Local polynomial (ridge) regression.
2004
     Local polynomial (ridge) regression.
2005
 
2005
 
2006
*magic*
2006
*magic*
2007
     A variety of methods for creating magic squares of any order greater
2007
     A variety of methods for creating magic squares of any order greater
2008
     than 2, and various magic hypercubes.
2008
     than 2, and various magic hypercubes.
2009
 
2009
 
2010
*mapdata*
2010
*mapdata*
2011
     Supplement to package *maps*, providing the larger and/or
2011
     Supplement to package *maps*, providing the larger and/or
2012
     higher-resolution databases.
2012
     higher-resolution databases.
2013
 
2013
 
2014
*mapproj*
2014
*mapproj*
2015
     Map Projections: converts latitude/longitude into projected
2015
     Map Projections: converts latitude/longitude into projected
2016
     coordinates.
2016
     coordinates.
2017
 
2017
 
2018
*maps*
2018
*maps*
2019
     Draw geographical maps.  Projection code and larger maps are in
2019
     Draw geographical maps.  Projection code and larger maps are in
2020
     separate packages.
2020
     separate packages.
2021
 
2021
 
2022
*maptools*
2022
*maptools*
2023
     Set of tools for manipulating and reading geographic data, in
2023
     Set of tools for manipulating and reading geographic data, in
2024
     particular ESRI shapefiles.
2024
     particular ESRI shapefiles.
2025
 
2025
 
2026
*maptree*
2026
*maptree*
2027
     Functions with example data for graphing and mapping models from
2027
     Functions with example data for graphing and mapping models from
2028
     hierarchical clustering and classification and regression trees.
2028
     hierarchical clustering and classification and regression trees.
2029
 
2029
 
2030
*maxstat*
2030
*maxstat*
2031
     Maximally selected rank and Gauss statistics with several p-value
2031
     Maximally selected rank and Gauss statistics with several p-value
2032
     approximations.
2032
     approximations.
2033
 
2033
 
2034
*mclust*
2034
*mclust*
2035
     Model-based cluster analysis: the 2002 version of MCLUST.
2035
     Model-based cluster analysis: the 2002 version of MCLUST.
2036
 
2036
 
2037
*mclust1998*
-
 
2038
     Model-based cluster analysis: the 1998 version of MCLUST.
-
 
2039
 
-
 
2040
*mda*
2037
*mda*
2041
     Code for mixture discriminant analysis (MDA), flexible discriminant
2038
     Code for mixture discriminant analysis (MDA), flexible discriminant
2042
     analysis (FDA), penalized discriminant analysis (PDA), multivariate
2039
     analysis (FDA), penalized discriminant analysis (PDA), multivariate
2043
     additive regression splines (MARS), adaptive back-fitting splines
2040
     additive regression splines (MARS), adaptive back-fitting splines
2044
     (BRUTO), and penalized regression.
2041
     (BRUTO), and penalized regression.
2045
 
2042
 
2046
*meanscore*
2043
*meanscore*
2047
     Mean Score method for missing covariate data in logistic regression
2044
     Mean Score method for missing covariate data in logistic regression
2048
     models.
2045
     models.
2049
 
2046
 
2050
*merror*
2047
*merror*
2051
     Accuracy and precision of measurements.
2048
     Accuracy and precision of measurements.
2052
 
2049
 
2053
*mgcv*
2050
*mgcv*
2054
     Routines for GAMs and other genralized ridge regression problems with
2051
     Routines for GAMs and other genralized ridge regression problems with
2055
     multiple smoothing parameter selection by GCV or UBRE.  _Recommended_.
2052
     multiple smoothing parameter selection by GCV or UBRE.  _Recommended_.
2056
 
2053
 
2057
*mimR*
2054
*mimR*
2058
     An R interface to MIM for graphical modeling in R.
2055
     An R interface to MIM for graphical modeling in R.
2059
 
2056
 
2060
*mix*
2057
*mix*
2061
     Estimation/multiple imputation programs for mixed categorical and
2058
     Estimation/multiple imputation programs for mixed categorical and
2062
     continuous data.
2059
     continuous data.
2063
 
2060
 
2064
*mlbench*
2061
*mlbench*
2065
     A collection of artificial and real-world machine learning benchmark
2062
     A collection of artificial and real-world machine learning benchmark
2066
     problems, including the Boston housing data.
2063
     problems, including the Boston housing data.
2067
 
2064
 
2068
*mmlcr*
2065
*mmlcr*
2069
     Mixed-mode latent class regression (also known as mixed-mode mixture
2066
     Mixed-mode latent class regression (also known as mixed-mode mixture
2070
     model regression or mixed-mode mixture regression models) which can
2067
     model regression or mixed-mode mixture regression models) which can
2071
     handle both longitudinal and one-time responses.
2068
     handle both longitudinal and one-time responses.
2072
 
2069
 
2073
*moc*
2070
*moc*
2074
     Fits a variety of mixtures models for multivariate observations with
2071
     Fits a variety of mixtures models for multivariate observations with
2075
     user-difined distributions and curves.
2072
     user-difined distributions and curves.
2076
 
2073
 
2077
*mscalib*
2074
*mscalib*
2078
     Calibration and filtering of MALDI-TOF Peptide Mass Fingerprint data.
2075
     Calibration and filtering of MALDI-TOF Peptide Mass Fingerprint data.
2079
 
2076
 
2080
*msm*
2077
*msm*
2081
     Functions for fitting continuous-time Markov multi-state models to
2078
     Functions for fitting continuous-time Markov multi-state models to
2082
     categorical processes observed at arbitrary times, optionally with
2079
     categorical processes observed at arbitrary times, optionally with
2083
     misclassified responses, and covariates on transition or
2080
     misclassified responses, and covariates on transition or
2084
     misclassification rates.
2081
     misclassification rates.
2085
 
2082
 
2086
*muhaz*
2083
*muhaz*
2087
     Hazard function estimation in survival analysis.
2084
     Hazard function estimation in survival analysis.
2088
 
2085
 
2089
*multcomp*
2086
*multcomp*
2090
     Multiple comparison procedures for the one-way layout.
2087
     Multiple comparison procedures for the one-way layout.
2091
 
2088
 
2092
*multidim*
2089
*multidim*
2093
     Multidimensional descriptive statistics: factorial methods and
2090
     Multidimensional descriptive statistics: factorial methods and
2094
     classification.
2091
     classification.
2095
 
2092
 
-
 
2093
*multinomRob*
-
 
2094
     Overdispersed multinomial regression using robust (LQD and tanh)
-
 
2095
     estimation.
-
 
2096
 
2096
*multiv*
2097
*multiv*
2097
     Functions for hierarchical clustering, partitioning, bond energy
2098
     Functions for hierarchical clustering, partitioning, bond energy
2098
     algorithm, Sammon mapping, PCA and correspondence analysis.
2099
     algorithm, Sammon mapping, PCA and correspondence analysis.
2099
 
2100
 
2100
*mvbutils*
2101
*mvbutils*
2101
     Utilities by Mark V. Bravington for project organization, editing and
2102
     Utilities by Mark V. Bravington for project organization, editing and
2102
     backup, sourcing, documentation (formal and informal), package
2103
     backup, sourcing, documentation (formal and informal), package
2103
     preparation, macro functions, and more.
2104
     preparation, macro functions, and more.
2104
 
2105
 
2105
*mvnmle*
2106
*mvnmle*
2106
     ML estimation for multivariate normal data with missing values.
2107
     ML estimation for multivariate normal data with missing values.
2107
 
2108
 
2108
*mvnormtest*
2109
*mvnormtest*
2109
     Generalization of the Shapiro-Wilk test for multivariate variables.
2110
     Generalization of the Shapiro-Wilk test for multivariate variables.
2110
 
2111
 
2111
*mvpart*
2112
*mvpart*
2112
     Multivariate partitioning.
2113
     Multivariate partitioning.
2113
 
2114
 
2114
*mvtnorm*
2115
*mvtnorm*
2115
     Multivariate normal and t distributions.
2116
     Multivariate normal and t distributions.
2116
 
2117
 
2117
*ncdf*
2118
*ncdf*
2118
     Interface to Unidata netCDF data files.
2119
     Interface to Unidata netCDF data files.
2119
 
2120
 
2120
*ncomplete*
2121
*ncomplete*
2121
     Functions to perform the regression depth method (RDM) to binary
2122
     Functions to perform the regression depth method (RDM) to binary
2122
     regression to approximate the minimum number of observations that can
2123
     regression to approximate the minimum number of observations that can
2123
     be removed such that the reduced data set has complete separation.
2124
     be removed such that the reduced data set has complete separation.
2124
 
2125
 
2125
*negenes*
2126
*negenes*
2126
     Estimating the number of essential genes in a genome on the basis of
2127
     Estimating the number of essential genes in a genome on the basis of
2127
     data from a random transposon mutagenesis experiment, through the use
2128
     data from a random transposon mutagenesis experiment, through the use
2128
     of a Gibbs sampler.
2129
     of a Gibbs sampler.
2129
 
2130
 
2130
*netCDF*
2131
*netCDF*
2131
     Read data from netCDF files.
2132
     Read data from netCDF files.
2132
 
2133
 
2133
*nlme*
2134
*nlme*
2134
     Fit and compare Gaussian linear and nonlinear mixed-effects models.
2135
     Fit and compare Gaussian linear and nonlinear mixed-effects models.
2135
     _Recommended_.
2136
     _Recommended_.
2136
 
2137
 
2137
*nlmeODE*
2138
*nlmeODE*
2138
     Combine the *nlme* and *odesolve* packages for mixed-effects modelling
2139
     Combine the *nlme* and *odesolve* packages for mixed-effects modelling
2139
     using differential equations.
2140
     using differential equations.
2140
 
2141
 
2141
*nlrq*
2142
*nlrq*
2142
     Nonlinear quantile regression.
2143
     Nonlinear quantile regression.
2143
 
2144
 
2144
*nnet*
2145
*nnet*
2145
     Software for single hidden layer perceptrons ("feed-forward neural
2146
     Software for single hidden layer perceptrons ("feed-forward neural
2146
     networks"), and for multinomial log-linear models.  Contained in the
2147
     networks"), and for multinomial log-linear models.  Contained in the
2147
     `VR' bundle.  _Recommended_.
2148
     `VR' bundle.  _Recommended_.
2148
 
2149
 
2149
*nor1mix*
2150
*nor1mix*
2150
     One-dimensional normal mixture models classes, for, e.g., density
2151
     One-dimensional normal mixture models classes, for, e.g., density
2151
     estimation or clustering algorithms research and teaching; providing
2152
     estimation or clustering algorithms research and teaching; providing
2152
     the widely used Marron-Wand densities.
2153
     the widely used Marron-Wand densities.
2153
 
2154
 
2154
*norm*
2155
*norm*
2155
     Analysis of multivariate normal datasets with missing values.
2156
     Analysis of multivariate normal datasets with missing values.
2156
 
2157
 
2157
*normalp*
2158
*normalp*
2158
     A collection of utilities for normal of order p distributions (General
2159
     A collection of utilities for normal of order p distributions (General
2159
     Error Distributions).
2160
     Error Distributions).
2160
 
2161
 
2161
*nortest*
2162
*nortest*
2162
     Five omnibus tests for the composite hypothesis of normality.
2163
     Five omnibus tests for the composite hypothesis of normality.
2163
 
2164
 
2164
*noverlap*
2165
*noverlap*
2165
     Functions to perform the regression depth method (RDM) to binary
2166
     Functions to perform the regression depth method (RDM) to binary
2166
     regression to approximate the amount of overlap, i.e., the minimal
2167
     regression to approximate the amount of overlap, i.e., the minimal
2167
     number of observations that need to be removed such that the reduced
2168
     number of observations that need to be removed such that the reduced
2168
     data set has no longer overlap.
2169
     data set has no longer overlap.
2169
 
2170
 
2170
*npmc*
2171
*npmc*
2171
     Nonparametric Multiple Comparisons:  provides simultaneous rank test
2172
     Nonparametric Multiple Comparisons:  provides simultaneous rank test
2172
     procedures for the one-way layout without presuming a certain
2173
     procedures for the one-way layout without presuming a certain
2173
     distribution.
2174
     distribution.
2174
 
2175
 
2175
*nprq*
2176
*nprq*
2176
     Nonparametric and sparse quantile regression methods.
2177
     Nonparametric and sparse quantile regression methods.
2177
 
2178
 
2178
*odesolve*
2179
*odesolve*
2179
     An interface for the Ordinary Differential Equation (ODE) solver lsoda.
2180
     An interface for the Ordinary Differential Equation (ODE) solver lsoda.
2180
     ODEs are expressed as R functions.
2181
     ODEs are expressed as R functions.
2181
 
2182
 
2182
*orientlib*
2183
*orientlib*
2183
     Representations, conversions and display of orientation SO(3) data.
2184
     Representations, conversions and display of orientation SO(3) data.
2184
 
2185
 
2185
*oz*
2186
*oz*
2186
     Functions for plotting Australia's coastline and state boundaries.
2187
     Functions for plotting Australia's coastline and state boundaries.
2187
 
2188
 
2188
*pamr*
2189
*pamr*
2189
     Pam: Prediction Analysis for Microarrays.
2190
     Pam: Prediction Analysis for Microarrays.
2190
 
2191
 
2191
*pan*
2192
*pan*
2192
     Multiple imputation for multivariate panel or clustered data.
2193
     Multiple imputation for multivariate panel or clustered data.
2193
 
2194
 
2194
*panel*
2195
*panel*
2195
     Functions and datasets for fitting models to Panel data.
2196
     Functions and datasets for fitting models to Panel data.
2196
 
2197
 
2197
*pastecs*
2198
*pastecs*
2198
     Package for Analysis of Space-Time Ecological Series.
2199
     Package for Analysis of Space-Time Ecological Series.
2199
 
2200
 
2200
*pcurve*
2201
*pcurve*
2201
     Fits a principal curve to a numeric multivariate dataset in arbitrary
2202
     Fits a principal curve to a numeric multivariate dataset in arbitrary
2202
     dimensions.  Produces diagnostic plots.  Also calculates Bray-Curtis
2203
     dimensions.  Produces diagnostic plots.  Also calculates Bray-Curtis
2203
     and other distance matrices and performs multi-dimensional scaling and
2204
     and other distance matrices and performs multi-dimensional scaling and
2204
     principal component analyses.
2205
     principal component analyses.
2205
 
2206
 
2206
*pear*
2207
*pear*
2207
     Periodic Autoregression Analysis.
2208
     Periodic Autoregression Analysis.
2208
 
2209
 
2209
*permax*
2210
*permax*
2210
     Functions intended to facilitate certain basic analyses of DNA array
2211
     Functions intended to facilitate certain basic analyses of DNA array
2211
     data, especially with regard to comparing expression levels between two
2212
     data, especially with regard to comparing expression levels between two
2212
     types of tissue.
2213
     types of tissue.
2213
 
2214
 
2214
*pheno*
2215
*pheno*
2215
     Some easy-to-use functions for time series analyses of (plant-)
2216
     Some easy-to-use functions for time series analyses of (plant-)
2216
     phenological data sets.
2217
     phenological data sets.
2217
 
2218
 
2218
*phyloarray*
2219
*phyloarray*
2219
     Software to process data from phylogenetic or identification
2220
     Software to process data from phylogenetic or identification
2220
     microarrays.
2221
     microarrays.
2221
 
2222
 
2222
*pinktoe*
2223
*pinktoe*
2223
     Converts S trees to HTML/Perl files for interactive tree traversal.
2224
     Converts S trees to HTML/Perl files for interactive tree traversal.
2224
 
2225
 
2225
*pixmap*
2226
*pixmap*
2226
     Functions for import, export, plotting and other manipulations of
2227
     Functions for import, export, plotting and other manipulations of
2227
     bitmapped images.
2228
     bitmapped images.
2228
 
2229
 
2229
*pls.pcr*
2230
*pls.pcr*
2230
     Multivariate regression by PLS and PCR.
2231
     Multivariate regression by PLS and PCR.
2231
 
2232
 
2232
*polspline*
2233
*polspline*
2233
     Routines for the polynomial spline fitting routines hazard regression,
2234
     Routines for the polynomial spline fitting routines hazard regression,
2234
     hazard estimation with flexible tails, logspline, lspec, polyclass, and
2235
     hazard estimation with flexible tails, logspline, lspec, polyclass, and
2235
     polymars, by C. Kooperberg and co-authors.
2236
     polymars, by C. Kooperberg and co-authors.
2236
 
2237
 
2237
*polynom*
2238
*polynom*
2238
     A collection of functions to implement a class for univariate
2239
     A collection of functions to implement a class for univariate
2239
     polynomial manipulations.
2240
     polynomial manipulations.
2240
 
2241
 
2241
*pps*
2242
*pps*
2242
     Functions to select samples using PPS (probability proportional to
2243
     Functions to select samples using PPS (probability proportional to
2243
     size) sampling, for stratified simple random sampling, and to compute
2244
     size) sampling, for stratified simple random sampling, and to compute
2244
     joint inclusion probabilities for Sampford's method of PPS sampling.
2245
     joint inclusion probabilities for Sampford's method of PPS sampling.
2245
 
2246
 
2246
*prabclus*
2247
*prabclus*
2247
     Distance based parametric bootstrap tests for clustering, mainly
2248
     Distance based parametric bootstrap tests for clustering, mainly
2248
     thought for presence-absence data (clustering of species distribution
2249
     thought for presence-absence data (clustering of species distribution
2249
     maps).  Jaccard and Kulczynski distance measures, clustering of MDS
2250
     maps).  Jaccard and Kulczynski distance measures, clustering of MDS
2250
     scores, and nearest neighbor based noise detection.
2251
     scores, and nearest neighbor based noise detection.
2251
 
2252
 
2252
*princurve*
2253
*princurve*
2253
     Fits a principal curve to a matrix of points in arbitrary dimension.
2254
     Fits a principal curve to a matrix of points in arbitrary dimension.
2254
 
2255
 
2255
*pspline*
2256
*pspline*
2256
     Smoothing splines with penalties on order m derivatives.
2257
     Smoothing splines with penalties on order m derivatives.
2257
 
2258
 
2258
*psy*
2259
*psy*
2259
     Various procedures used in psychometry: Kappa, ICC, Cronbach alpha,
2260
     Various procedures used in psychometry: Kappa, ICC, Cronbach alpha,
2260
     screeplot, PCA and related methods.
2261
     screeplot, PCA and related methods.
2261
 
2262
 
2262
*qtl*
2263
*qtl*
2263
     Analysis of experimental crosses to identify QTLs.
2264
     Analysis of experimental crosses to identify QTLs.
2264
 
2265
 
2265
*quadprog*
2266
*quadprog*
2266
     For solving quadratic programming problems.
2267
     For solving quadratic programming problems.
2267
 
2268
 
2268
*quantreg*
2269
*quantreg*
2269
     Quantile regression and related methods.
2270
     Quantile regression and related methods.
2270
 
2271
 
2271
*qvcalc*
2272
*qvcalc*
2272
     Functions to compute quasi-variances and associated measures of
2273
     Functions to compute quasi-variances and associated measures of
2273
     approximation error.
2274
     approximation error.
2274
 
2275
 
2275
*randomForest*
2276
*randomForest*
2276
     Breiman's random forest classifier.
2277
     Breiman's random forest classifier.
2277
 
2278
 
-
 
2279
*ref*
-
 
2280
     Functions for creating references, reading from and writing ro
-
 
2281
     references and a memory efficient refdata type that transparently
-
 
2282
     encapsulates matrices and data frames.
-
 
2283
 
2278
*relimp*
2284
*relimp*
2279
     Functions to facilitate inference on the relative importance of
2285
     Functions to facilitate inference on the relative importance of
2280
     predictors in a linear or generalized linear model.
2286
     predictors in a linear or generalized linear model.
2281
 
2287
 
2282
*rgdal*
2288
*rgdal*
2283
     Provides bindings to Frank Warmerdam's Geospatial Data Abstraction
2289
     Provides bindings to Frank Warmerdam's Geospatial Data Abstraction
2284
     Library (GDAL).
2290
     Library (GDAL).
2285
 
2291
 
2286
*rgenoud*
2292
*rgenoud*
2287
     R version of GENetic Optimization Using Derivatives.
2293
     R version of GENetic Optimization Using Derivatives.
2288
 
2294
 
2289
*rimage*
2295
*rimage*
2290
     Functions for image processing, including Sobel filter, rank filters,
2296
     Functions for image processing, including Sobel filter, rank filters,
2291
     fft, histogram equalization, and reading JPEG files.
2297
     fft, histogram equalization, and reading JPEG files.
2292
 
2298
 
2293
*rmeta*
2299
*rmeta*
2294
     Functions for simple fixed and random effects meta-analysis for
2300
     Functions for simple fixed and random effects meta-analysis for
2295
     two-sample comparison of binary outcomes.
2301
     two-sample comparison of binary outcomes.
2296
 
2302
 
2297
*rpart*
2303
*rpart*
2298
     Recursive PARTitioning and regression trees.  _Recommended_.
2304
     Recursive PARTitioning and regression trees.  _Recommended_.
2299
 
2305
 
2300
*rpvm*
2306
*rpvm*
2301
     R interface to PVM (Parallel Virtual Machine).  Provides interface to
2307
     R interface to PVM (Parallel Virtual Machine).  Provides interface to
2302
     PVM APIs, and examples and documentation for its use.
2308
     PVM APIs, and examples and documentation for its use.
2303
 
2309
 
2304
*rqmcmb2*
2310
*rqmcmb2*
2305
     Markov chain marginal bootstrap for quantile regression.
2311
     Markov chain marginal bootstrap for quantile regression.
2306
 
2312
 
2307
*rsprng*
2313
*rsprng*
2308
     Provides interface to SPRNG (Scalable Parallel Random Number
2314
     Provides interface to SPRNG (Scalable Parallel Random Number
2309
     Generators) APIs, and examples and documentation for its use.
2315
     Generators) APIs, and examples and documentation for its use.
2310
 
2316
 
2311
*sampfling*
2317
*sampfling*
2312
     Implements a modified version of the Sampford sampling algorithm.
2318
     Implements a modified version of the Sampford sampling algorithm.
2313
     Given a quantity assigned to each unit in the population, samples are
2319
     Given a quantity assigned to each unit in the population, samples are
2314
     drawn with probability proportional to te product of the quantities of
2320
     drawn with probability proportional to te product of the quantities of
2315
     the units included in the sample.
2321
     the units included in the sample.
2316
 
2322
 
2317
*sca*
2323
*sca*
2318
     Simple Component Analysis.
2324
     Simple Component Analysis.
2319
 
2325
 
2320
*scatterplot3d*
2326
*scatterplot3d*
2321
     Plots a three dimensional (3D) point cloud perspectively.
2327
     Plots a three dimensional (3D) point cloud perspectively.
2322
 
2328
 
2323
*seacarb*
2329
*seacarb*
2324
     Calculates parameters of the seawater carbonate system.
2330
     Calculates parameters of the seawater carbonate system.
2325
 
2331
 
2326
*seao*
2332
*seao*
2327
     Simple Evolutionary Algorithm Optimization.
2333
     Simple Evolutionary Algorithm Optimization.
2328
 
2334
 
2329
*seao.gui*
2335
*seao.gui*
2330
     Simple Evolutionary Algorithm Optimization: graphical user interface.
2336
     Simple Evolutionary Algorithm Optimization: graphical user interface.
2331
 
2337
 
2332
*segmented*
2338
*segmented*
2333
     Functions to estimate break-points of segmented relationships in
2339
     Functions to estimate break-points of segmented relationships in
2334
     regression models (GLMs).
2340
     regression models (GLMs).
2335
 
2341
 
2336
*sem*
2342
*sem*
2337
     Functions for fitting general linear Structural Equation Models (with
2343
     Functions for fitting general linear Structural Equation Models (with
2338
     observed and unobserved variables) by the method of maximum likelihood
2344
     observed and unobserved variables) by the method of maximum likelihood
2339
     using the RAM approach.
2345
     using the RAM approach.
2340
 
2346
 
2341
*serialize*
2347
*serialize*
2342
     Simple interfce for serializing to connections.
2348
     Simple interfce for serializing to connections.
2343
 
2349
 
2344
*session*
2350
*session*
2345
     Functions for interacting with, saving and restoring R sessions.
2351
     Functions for interacting with, saving and restoring R sessions.
2346
 
2352
 
2347
*sfsmisc*
2353
*sfsmisc*
2348
     Utilities from Seminar fuer Statistik ETH Zurich.
2354
     Utilities from Seminar fuer Statistik ETH Zurich.
2349
 
2355
 
2350
*sgeostat*
2356
*sgeostat*
2351
     An object-oriented framework for geostatistical modeling.
2357
     An object-oriented framework for geostatistical modeling.
2352
 
2358
 
2353
*shapefiles*
2359
*shapefiles*
2354
     Functions to read and write ESRI shapefiles.
2360
     Functions to read and write ESRI shapefiles.
2355
 
2361
 
2356
*shapes*
2362
*shapes*
2357
     Routines for the statistical analysis of shapes, including procrustes
2363
     Routines for the statistical analysis of shapes, including procrustes
2358
     analysis, displaying shapes and principal components, testing for mean
2364
     analysis, displaying shapes and principal components, testing for mean
2359
     shape difference, thin-plate spline transformation grids and edge
2365
     shape difference, thin-plate spline transformation grids and edge
2360
     superimposition methods.
2366
     superimposition methods.
2361
 
2367
 
2362
*simpleboot*
2368
*simpleboot*
2363
     Simple bootstrap routines.
2369
     Simple bootstrap routines.
2364
 
2370
 
2365
*sm*
2371
*sm*
2366
     Software linked to the book "Applied Smoothing Techniques for Data
2372
     Software linked to the book "Applied Smoothing Techniques for Data
2367
     Analysis:  The Kernel Approach with S-PLUS Illustrations" by A. W.
2373
     Analysis:  The Kernel Approach with S-PLUS Illustrations" by A. W.
2368
     Bowman and A. Azzalini (1997), Oxford University Press.
2374
     Bowman and A. Azzalini (1997), Oxford University Press.
2369
 
2375
 
2370
*sma*
2376
*sma*
2371
     Functions for exploratory (statistical) microarray analysis.
2377
     Functions for exploratory (statistical) microarray analysis.
2372
 
2378
 
2373
*smoothSurv*
2379
*smoothSurv*
2374
     Survival regression with smoothed error distribution.
2380
     Survival regression with smoothed error distribution.
2375
 
2381
 
2376
*sn*
2382
*sn*
2377
     Functions for manipulating skew-normal probability distributions and
2383
     Functions for manipulating skew-normal probability distributions and
2378
     for fitting them to data, in the scalar and the multivariate case.
2384
     for fitting them to data, in the scalar and the multivariate case.
2379
 
2385
 
2380
*sna*
2386
*sna*
2381
     A range of tools for social network analysis, including node and
2387
     A range of tools for social network analysis, including node and
2382
     graph-level indices, structural distance and covariance methods,
2388
     graph-level indices, structural distance and covariance methods,
2383
     structural equivalence detection, p* modeling, and network
2389
     structural equivalence detection, p* modeling, and network
2384
     visualization.
2390
     visualization.
2385
 
2391
 
2386
*snow*
2392
*snow*
2387
     Simple Network of Workstations: support for simple parallel computing
2393
     Simple Network of Workstations: support for simple parallel computing
2388
     in R.
2394
     in R.
2389
 
2395
 
2390
*som*
2396
*som*
2391
     Self-Organizing Maps (with application in gene clustering).
2397
     Self-Organizing Maps (with application in gene clustering).
2392
 
2398
 
2393
*sound*
2399
*sound*
2394
     A sound interface for R: Basic functions for dealing with `.wav' files
2400
     A sound interface for R: Basic functions for dealing with `.wav' files
2395
     and sound samples.
2401
     and sound samples.
2396
 
2402
 
2397
*spatial*
2403
*spatial*
2398
     Functions for kriging and point pattern analysis from "Modern Applied
2404
     Functions for kriging and point pattern analysis from "Modern Applied
2399
     Statistics with S" by W. Venables and B. Ripley.  Contained in the
2405
     Statistics with S" by W. Venables and B. Ripley.  Contained in the
2400
     `VR' bundle.  _Recommended_.
2406
     `VR' bundle.  _Recommended_.
2401
 
2407
 
2402
*spatstat*
2408
*spatstat*
2403
     Data analysis and modelling of two-dimensional point patterns,
2409
     Data analysis and modelling of two-dimensional point patterns,
2404
     including multitype points and spatial covariates.
2410
     including multitype points and spatial covariates.
2405
 
2411
 
2406
*spdep*
2412
*spdep*
2407
     A collection of functions to create spatial weights matrix objects from
2413
     A collection of functions to create spatial weights matrix objects from
2408
     polygon contiguities, from point patterns by distance and tesselations,
2414
     polygon contiguities, from point patterns by distance and tesselations,
2409
     for summarising these objects, and for permitting their use in spatial
2415
     for summarising these objects, and for permitting their use in spatial
2410
     data analysis; a collection of tests for spatial autocorrelation,
2416
     data analysis; a collection of tests for spatial autocorrelation,
2411
     including global Moran's I and Geary's C, local Moran's I, saddlepoint
2417
     including global Moran's I and Geary's C, local Moran's I, saddlepoint
2412
     approximations for global and local Moran's I; and functions for
2418
     approximations for global and local Moran's I; and functions for
2413
     estimating spatial simultaneous autoregressive (SAR) models.  (Was
2419
     estimating spatial simultaneous autoregressive (SAR) models.  (Was
2414
     formerly the three packages: *spweights*, *sptests*, and *spsarlm*.)
2420
     formerly the three packages: *spweights*, *sptests*, and *spsarlm*.)
2415
 
2421
 
2416
*splancs*
2422
*splancs*
2417
     Spatial and space-time point pattern analysis functions.
2423
     Spatial and space-time point pattern analysis functions.
2418
 
2424
 
2419
*statmod*
2425
*statmod*
2420
     Miscellaneous biostatistical modelling functions.
2426
     Miscellaneous biostatistical modelling functions.
2421
 
2427
 
2422
*strucchange*
2428
*strucchange*
2423
     Various tests on structural change in linear regression models.
2429
     Various tests on structural change in linear regression models.
2424
 
2430
 
2425
*subselect*
2431
*subselect*
2426
     A collection of functions which assess the quality of variable subsets
2432
     A collection of functions which assess the quality of variable subsets
2427
     as surrogates for a full data set, and search for subsets which are
2433
     as surrogates for a full data set, and search for subsets which are
2428
     optimal under various criteria.
2434
     optimal under various criteria.
2429
 
2435
 
2430
*supclust*
2436
*supclust*
2431
     Methodology for supervised grouping of predictor variables.
2437
     Methodology for supervised grouping of predictor variables.
2432
 
2438
 
2433
*survey*
2439
*survey*
2434
     Summary statistics, generalized linear models, and general maximum
2440
     Summary statistics, generalized linear models, and general maximum
2435
     likelihood estimation for stratified, cluster-sampled, unequally
2441
     likelihood estimation for stratified, cluster-sampled, unequally
2436
     weighted survey samples.
2442
     weighted survey samples.
2437
 
2443
 
2438
*survival*
2444
*survival*
2439
     Functions for survival analysis, including penalised likelihood.
2445
     Functions for survival analysis, including penalised likelihood.
2440
     _Recommended_.
2446
     _Recommended_.
2441
 
2447
 
2442
*survrec*
2448
*survrec*
2443
     Survival analysis for recurrent event data.
2449
     Survival analysis for recurrent event data.
2444
 
2450
 
2445
*systemfit*
2451
*systemfit*
2446
     Contains functions for fitting simultaneous systems of equations using
2452
     Contains functions for fitting simultaneous systems of equations using
2447
     Ordinary Least Sqaures (OLS), Two-Stage Least Squares (2SLS), and
2453
     Ordinary Least Sqaures (OLS), Two-Stage Least Squares (2SLS), and
2448
     Three-Stage Least Squares (3SLS).
2454
     Three-Stage Least Squares (3SLS).
2449
 
2455
 
2450
*tapiR*
2456
*tapiR*
2451
     Tools for accessing (UK) parliamentary information in R.
2457
     Tools for accessing (UK) parliamentary information in R.
2452
 
2458
 
2453
*tensor*
2459
*tensor*
2454
     Tensor product of arrays.
2460
     Tensor product of arrays.
2455
 
2461
 
2456
*tkrplot*
2462
*tkrplot*
2457
     Simple mechanism for placing R graphics in a Tk widget.
2463
     Simple mechanism for placing R graphics in a Tk widget.
2458
 
2464
 
2459
*tree*
2465
*tree*
2460
     Classification and regression trees.
2466
     Classification and regression trees.
2461
 
2467
 
2462
*tripack*
2468
*tripack*
2463
     A constrained two-dimensional Delaunay triangulation package.
2469
     A constrained two-dimensional Delaunay triangulation package.
2464
 
2470
 
2465
*tseries*
2471
*tseries*
2466
     Package for time series analysis with emphasis on non-linear modelling.
2472
     Package for time series analysis with emphasis on non-linear modelling.
2467
 
2473
 
2468
*twostage*
2474
*twostage*
2469
     Functions for optimal design of two-stage-studies using the Mean Score
2475
     Functions for optimal design of two-stage-studies using the Mean Score
2470
     method.
2476
     method.
2471
 
2477
 
2472
*udunits*
2478
*udunits*
2473
     Interface to Unidata's routines to convert units.
2479
     Interface to Unidata's routines to convert units.
2474
 
2480
 
2475
*vardiag*
2481
*vardiag*
2476
     Interactive variogram diagnostics.
2482
     Interactive variogram diagnostics.
2477
 
2483
 
2478
*vcd*
2484
*vcd*
2479
     Functions and data sets based on the book "Visualizing Categorical
2485
     Functions and data sets based on the book "Visualizing Categorical
2480
     Data" by Michael Friendly.
2486
     Data" by Michael Friendly.
2481
 
2487
 
2482
*vegan*
2488
*vegan*
2483
     Various help functions for vegetation scientists and community
2489
     Various help functions for vegetation scientists and community
2484
     ecologists.
2490
     ecologists.
2485
 
2491
 
2486
*waveslim*
2492
*waveslim*
2487
     Basic wavelet routines for time series analysis.
2493
     Basic wavelet routines for time series analysis.
2488
 
2494
 
2489
*wavethresh*
2495
*wavethresh*
2490
     Software to perform 1-d and 2-d wavelet statistics and transforms.
2496
     Software to perform 1-d and 2-d wavelet statistics and transforms.
2491
 
2497
 
2492
*wle*
2498
*wle*
2493
     Robust statistical inference via a weighted likelihood approach.
2499
     Robust statistical inference via a weighted likelihood approach.
2494
 
2500
 
2495
*xgobi*
2501
*xgobi*
2496
     Interface to the XGobi and XGvis programs for graphical data analysis.
2502
     Interface to the XGobi and XGvis programs for graphical data analysis.
2497
 
2503
 
2498
*xtable*
2504
*xtable*
2499
     Export data to LaTeX and HTML tables.
2505
     Export data to LaTeX and HTML tables.
2500
 
2506
 
2501
See CRAN `src/contrib/PACKAGES' for more information.
2507
See CRAN `src/contrib/PACKAGES' for more information.
2502
 
2508
 
2503
   There is also a CRAN `src/contrib/Devel' directory which contains
2509
   There is also a CRAN `src/contrib/Devel' directory which contains
2504
packages still "under development" or depending on features only present in
2510
packages still "under development" or depending on features only present in
2505
the current development versions of R.  Volunteers are invited to give
2511
the current development versions of R.  Volunteers are invited to give
2506
these a try, of course.  This area of CRAN currently contains
2512
these a try, of course.  This area of CRAN currently contains
2507
 
2513
 
2508
*Dopt*
2514
*Dopt*
2509
     Finding D-optimal experimental designs.
2515
     Finding D-optimal experimental designs.
2510
 
2516
 
2511
*GLMMGibbs*
2517
*GLMMGibbs*
2512
     Generalised Linear Mixed Models by Gibbs sampling.
2518
     Generalised Linear Mixed Models by Gibbs sampling.
2513
 
2519
 
2514
*RPgSQL*
2520
*RPgSQL*
2515
     Provides methods for accessing data stored in PostgreSQL tables.
2521
     Provides methods for accessing data stored in PostgreSQL tables.
2516
 
2522
 
2517
*Rmpi*
2523
*Rmpi*
2518
     An interface (wrapper) to MPI (Message-Passing Interface) APIs.  It
2524
     An interface (wrapper) to MPI (Message-Passing Interface) APIs.  It
2519
     also provides interactive R slave functionalities to make MPI
2525
     also provides interactive R slave functionalities to make MPI
2520
     programming easier in R than in C(++) or FORTRAN.
2526
     programming easier in R than in C(++) or FORTRAN.
2521
 
2527
 
2522
*dseplus*
2528
*dseplus*
2523
     Extensions to *dse*, the Dynamic Systems Estimation multivariate time
2529
     Extensions to *dse*, the Dynamic Systems Estimation multivariate time
2524
     series package.  Contains PADI, juice and monitoring extensions.
2530
     series package.  Contains PADI, juice and monitoring extensions.
2525
 
2531
 
2526
*ensemble*
2532
*ensemble*
2527
     Ensembles of tree classifiers.
2533
     Ensembles of tree classifiers.
2528
 
2534
 
2529
*runStat*
2535
*runStat*
2530
     Running median and mean.
2536
     Running median and mean.
2531
 
2537
 
2532
*write.snns*
2538
*write.snns*
2533
     Function for writing a SNNS pattern file from a data frame or matrix.
2539
     Function for writing a SNNS pattern file from a data frame or matrix.
2534
 
2540
 
2535
5.1.3 Add-on packages from Omegahat
2541
5.1.3 Add-on packages from Omegahat
2536
-----------------------------------
2542
-----------------------------------
2537
 
2543
 
2538
The `src/contrib/Omegahat' Directory of a CRAN site contains yet unreleased
2544
The `src/contrib/Omegahat' Directory of a CRAN site contains yet unreleased
2539
packages from the Omegahat Project for Statistical Computing
2545
packages from the Omegahat Project for Statistical Computing
2540
(http://www.omegahat.org/).  Currently, there are
2546
(http://www.omegahat.org/).  Currently, there are
2541
 
2547
 
2542
*CORBA*
2548
*CORBA*
2543
     Dynamic CORBA client/server facilities for R.  Connects to other
2549
     Dynamic CORBA client/server facilities for R.  Connects to other
2544
     CORBA-aware applications developed in arbitrary languages, on different
2550
     CORBA-aware applications developed in arbitrary languages, on different
2545
     machines and allows R functionality to be exported in the same way to
2551
     machines and allows R functionality to be exported in the same way to
2546
     other applications.
2552
     other applications.
2547
 
2553
 
2548
*OOP*
2554
*OOP*
2549
     OOP style classes and methods for R and S-PLUS.  Object references and
2555
     OOP style classes and methods for R and S-PLUS.  Object references and
2550
     class-based method definition are supported in the style of languages
2556
     class-based method definition are supported in the style of languages
2551
     such as Java and C++.
2557
     such as Java and C++.
2552
 
2558
 
2553
*REmbeddedPostgres*
2559
*REmbeddedPostgres*
2554
     Allows R functions and objects to be used to implement SQL functions --
2560
     Allows R functions and objects to be used to implement SQL functions --
2555
     per-record, aggregate and trigger functions.
2561
     per-record, aggregate and trigger functions.
2556
 
2562
 
2557
*REventLoop*
2563
*REventLoop*
2558
     An abstract event loop mechanism that is toolkit independent and can be
2564
     An abstract event loop mechanism that is toolkit independent and can be
2559
     used to to replace the R event loop.
2565
     used to to replace the R event loop.
2560
 
2566
 
2561
*RGdkPixbuf*
2567
*RGdkPixbuf*
2562
     S language functions to access the facilities in the GdkPixbuf library
2568
     S language functions to access the facilities in the GdkPixbuf library
2563
     for manipulating images.
2569
     for manipulating images.
2564
 
2570
 
2565
*RGnumeric*
2571
*RGnumeric*
2566
     A plugin for the Gnumeric spreadsheet that allows R functions to be
2572
     A plugin for the Gnumeric spreadsheet that allows R functions to be
2567
     called from cells within the sheet, automatic recalculation, etc.
2573
     called from cells within the sheet, automatic recalculation, etc.
2568
 
2574
 
2569
*RGtk*
2575
*RGtk*
2570
     Facilities in the S language for programming graphical interfaces using
2576
     Facilities in the S language for programming graphical interfaces using
2571
     Gtk, the Gnome GUI toolkit.
2577
     Gtk, the Gnome GUI toolkit.
2572
 
2578
 
2573
*RGtkBindingGenerator*
2579
*RGtkBindingGenerator*
2574
     A meta-package which generates C and R code to provide bindings to a
2580
     A meta-package which generates C and R code to provide bindings to a
2575
     Gtk-based library.
2581
     Gtk-based library.
2576
 
2582
 
2577
*RGtkExtra*
2583
*RGtkExtra*
2578
     A collection of S functions that provide an interface to the widgets in
2584
     A collection of S functions that provide an interface to the widgets in
2579
     the gtk+extra library such as the GtkSheet data-grid display, icon
2585
     the gtk+extra library such as the GtkSheet data-grid display, icon
2580
     list, file list and directory tree.
2586
     list, file list and directory tree.
2581
 
2587
 
2582
*RGtkGlade*
2588
*RGtkGlade*
2583
     S language bindings providing an interface to Glade, the interactive
2589
     S language bindings providing an interface to Glade, the interactive
2584
     Gnome GUI creator.
2590
     Gnome GUI creator.
2585
 
2591
 
2586
*RGtkHTML*
2592
*RGtkHTML*
2587
     A collection of S functions that provide an interface to creating and
2593
     A collection of S functions that provide an interface to creating and
2588
     controlling an HTML widget which can be used to display HTML documents
2594
     controlling an HTML widget which can be used to display HTML documents
2589
     from files or content generated dynamically in S.
2595
     from files or content generated dynamically in S.
2590
 
2596
 
2591
*RGtkViewers*
2597
*RGtkViewers*
2592
     A collection of tools for viewing different S objects, databases, class
2598
     A collection of tools for viewing different S objects, databases, class
2593
     and widget hierarchies, S source file contents, etc.
2599
     and widget hierarchies, S source file contents, etc.
2594
 
2600
 
2595
*RJavaDevice*
2601
*RJavaDevice*
2596
     A graphics device for R that uses Java components and graphics.  APIs.
2602
     A graphics device for R that uses Java components and graphics.  APIs.
2597
 
2603
 
2598
*RObjectTables*
2604
*RObjectTables*
2599
     The C and S code allows one to define R objects to be used as elements
2605
     The C and S code allows one to define R objects to be used as elements
2600
     of the search path with their own semantics and facilities for reading
2606
     of the search path with their own semantics and facilities for reading
2601
     and writing variables.  The objects implement a simple interface via R
2607
     and writing variables.  The objects implement a simple interface via R
2602
     functions (either methods or closures) and can access external data,
2608
     functions (either methods or closures) and can access external data,
2603
     e.g., in other applications, languages, formats, ...
2609
     e.g., in other applications, languages, formats, ...
2604
 
2610
 
2605
*RSMethods*
2611
*RSMethods*
2606
     An implementation of S version 4 methods and classes for R, consistent
2612
     An implementation of S version 4 methods and classes for R, consistent
2607
     with the basic material in "Programming with Data" by John M.
2613
     with the basic material in "Programming with Data" by John M.
2608
     Chambers, 1998, Springer NY.
2614
     Chambers, 1998, Springer NY.
2609
 
2615
 
2610
*RSPerl*
2616
*RSPerl*
2611
     An interface from R to an embedded, persistent Perl interpreter,
2617
     An interface from R to an embedded, persistent Perl interpreter,
2612
     allowing one to call arbitrary Perl subroutines, classes and methods.
2618
     allowing one to call arbitrary Perl subroutines, classes and methods.
2613
 
2619
 
2614
*RSPython*
2620
*RSPython*
2615
     Allows Python programs to invoke S functions, methods, etc., and S code
2621
     Allows Python programs to invoke S functions, methods, etc., and S code
2616
     to call Python functionality.
2622
     to call Python functionality.
2617
 
2623
 
2618
*RXLisp*
2624
*RXLisp*
2619
     An interface to call XLisp-Stat functions from within R.
2625
     An interface to call XLisp-Stat functions from within R.
2620
 
2626
 
2621
*SASXML*
2627
*SASXML*
2622
     Example for reading XML files in SAS 8.2 manner.
2628
     Example for reading XML files in SAS 8.2 manner.
2623
 
2629
 
2624
*SJava*
2630
*SJava*
2625
     An interface from R to Java to create and call Java objects and
2631
     An interface from R to Java to create and call Java objects and
2626
     methods.
2632
     methods.
2627
 
2633
 
2628
*SLanguage*
2634
*SLanguage*
2629
     Functions and C support utilities to support S language programming
2635
     Functions and C support utilities to support S language programming
2630
     that can work in both R and S-PLUS.
2636
     that can work in both R and S-PLUS.
2631
 
2637
 
2632
*SNetscape*
2638
*SNetscape*
2633
     Plugin for Netscape and JavaScript.
2639
     Plugin for Netscape and JavaScript.
2634
 
2640
 
2635
*SWinRegistry*
2641
*SWinRegistry*
2636
     Provides access from within R to read and write the Windows registry.
2642
     Provides access from within R to read and write the Windows registry.
2637
 
2643
 
2638
*SWinTypeLibs*
2644
*SWinTypeLibs*
2639
     Provides ways to extract type information from type libraries and/or
2645
     Provides ways to extract type information from type libraries and/or
2640
     DCOM objects that describes the methods, properties, etc. of an
2646
     DCOM objects that describes the methods, properties, etc. of an
2641
     interface.
2647
     interface.
2642
 
2648
 
2643
*SXalan*
2649
*SXalan*
2644
     Process XML documents using XSL functions implemented in R and
2650
     Process XML documents using XSL functions implemented in R and
2645
     dynamically substituting output from R.
2651
     dynamically substituting output from R.
2646
 
2652
 
2647
*Slcc*
2653
*Slcc*
2648
     Parses C source code, allowing one to analyze and automatically
2654
     Parses C source code, allowing one to analyze and automatically
2649
     generate interfaces from S to that code, including the table of
2655
     generate interfaces from S to that code, including the table of
2650
     S-accessible native symbols, parameter count and type information, S
2656
     S-accessible native symbols, parameter count and type information, S
2651
     constructors from C objects, call graphs, etc.
2657
     constructors from C objects, call graphs, etc.
2652
 
2658
 
2653
*Sxslt*
2659
*Sxslt*
2654
     An extension module for libxslt, the XML-XSL document translator, that
2660
     An extension module for libxslt, the XML-XSL document translator, that
2655
     allows XSL functions to be implemented via R functions.
2661
     allows XSL functions to be implemented via R functions.
2656
 
2662
 
2657
5.1.4 Add-on packages from BioConductor
2663
5.1.4 Add-on packages from BioConductor
2658
---------------------------------------
2664
---------------------------------------
2659
 
2665
 
2660
The Bioconductor Project (http://www.bioconductor.org) produces an open
2666
The Bioconductor Project (http://www.bioconductor.org) produces an open
2661
source software framework that will assist biologists and statisticians
2667
source software framework that will assist biologists and statisticians
2662
working in bioinformatics, with primary emphasis on inference using DNA
2668
working in bioinformatics, with primary emphasis on inference using DNA
2663
microarrays.  The following R packages are contained in the current release
2669
microarrays.  The following R packages are contained in the current release
2664
of BioConductor, with more packages under development.
2670
of BioConductor, with more packages under development.
2665
 
2671
 
2666
*AnnBuilder*
2672
*AnnBuilder*
2667
     Assemble and process genomic annotation data, from databases such as
2673
     Assemble and process genomic annotation data, from databases such as
2668
     GenBank, the Gene Ontology Consortium, LocusLink, UniGene, the UCSC
2674
     GenBank, the Gene Ontology Consortium, LocusLink, UniGene, the UCSC
2669
     Human Genome Project.
2675
     Human Genome Project.
2670
 
2676
 
2671
*Biobase*
2677
*Biobase*
2672
     Object-oriented representation and manipulation of genomic data (S4
2678
     Object-oriented representation and manipulation of genomic data (S4
2673
     class structure).
2679
     class structure).
2674
 
2680
 
2675
*DynDoc*
2681
*DynDoc*
2676
     Functionality to create and interact with dynamic documents, vignettes,
2682
     Functionality to create and interact with dynamic documents, vignettes,
2677
     and other navigable documents.
2683
     and other navigable documents.
2678
 
2684
 
2679
*MAGEML*
2685
*MAGEML*
2680
     Functionality to handle MAGEML documents.
2686
     Functionality to handle MAGEML documents.
2681
 
2687
 
2682
*RBGL*
2688
*RBGL*
2683
     An interface between the graph package and the Boost graph libraries,
2689
     An interface between the graph package and the Boost graph libraries,
2684
     allowing for fast manipulation of graph objects in R.
2690
     allowing for fast manipulation of graph objects in R.
2685
 
2691
 
2686
*ROC*
2692
*ROC*
2687
     Receiver Operating Characteristic (ROC) approach for identifying genes
2693
     Receiver Operating Characteristic (ROC) approach for identifying genes
2688
     that are differentially expressed in two types of samples.
2694
     that are differentially expressed in two types of samples.
2689
 
2695
 
2690
*RdbiPgSQL*
2696
*RdbiPgSQL*
2691
     Methods for accessing data stored in PostgreSQL tables.
2697
     Methods for accessing data stored in PostgreSQL tables.
2692
 
2698
 
2693
*Rgraphviz*
2699
*Rgraphviz*
2694
     An interface with Graphviz for plotting graph objects in R.
2700
     An interface with Graphviz for plotting graph objects in R.
2695
 
2701
 
2696
*Ruuid*
2702
*Ruuid*
2697
     Creates Universally Unique ID values (UUIDs) in R.
2703
     Creates Universally Unique ID values (UUIDs) in R.
2698
 
2704
 
2699
*SAGElyzer*
2705
*SAGElyzer*
2700
     Locates genes based on SAGE tags.
2706
     Locates genes based on SAGE tags.
2701
 
2707
 
2702
*SNPtools*
2708
*SNPtools*
2703
     Rudimentary structures for SNP data.
2709
     Rudimentary structures for SNP data.
2704
 
2710
 
2705
*affy*
2711
*affy*
2706
     Methods for Affymetrix Oligonucleotide Arrays.
2712
     Methods for Affymetrix Oligonucleotide Arrays.
2707
 
2713
 
2708
*affyPLM*
2714
*affyPLM*
2709
     For fitting Probe Level Models.
2715
     For fitting Probe Level Models.
2710
 
2716
 
2711
*affycomp*
2717
*affycomp*
2712
     Graphics toolbox for assessment of Affymetrix expression measures.
2718
     Graphics toolbox for assessment of Affymetrix expression measures.
2713
 
2719
 
2714
*affydata*
2720
*affydata*
2715
     Affymetrix data for demonstration purposes.
2721
     Affymetrix data for demonstration purposes.
2716
 
2722
 
2717
*annaffy*
2723
*annaffy*
2718
     Functions for handling data from Bioconductor Affymetrix annotation
2724
     Functions for handling data from Bioconductor Affymetrix annotation
2719
     data packages.
2725
     data packages.
2720
 
2726
 
2721
*annotate*
2727
*annotate*
2722
     Associate experimental data in real time to biological metadata from
2728
     Associate experimental data in real time to biological metadata from
2723
     web databases such as GenBank, LocusLink and PubMed.  Process and store
2729
     web databases such as GenBank, LocusLink and PubMed.  Process and store
2724
     query results.  Generate HTML reports of analyses.
2730
     query results.  Generate HTML reports of analyses.
2725
 
2731
 
2726
*ctc*
2732
*ctc*
2727
     Tools to export and import Tree and Cluster to other programs.
2733
     Tools to export and import Tree and Cluster to other programs.
2728
 
2734
 
2729
*daMA*
2735
*daMA*
2730
     Functions for the efficient design of factorial two-color microarray
2736
     Functions for the efficient design of factorial two-color microarray
2731
     experiments and for the statistical analysis of factorial microarray
2737
     experiments and for the statistical analysis of factorial microarray
2732
     data.
2738
     data.
2733
 
2739
 
2734
*edd*
2740
*edd*
2735
     Expression density diagnostics: graphical methods and pattern
2741
     Expression density diagnostics: graphical methods and pattern
2736
     recognition algorithms for distribution shape classification.
2742
     recognition algorithms for distribution shape classification.
2737
 
2743
 
2738
*externalVector*
2744
*externalVector*
2739
     Basic class definitions and generics for external pointer based vector
2745
     Basic class definitions and generics for external pointer based vector
2740
     objects for R.
2746
     objects for R.
2741
 
2747
 
2742
*factDesign*
2748
*factDesign*
2743
     A set of tools for analyzing data from factorial designed micraorray
2749
     A set of tools for analyzing data from factorial designed micraorray
2744
     experiments.  The functions can be used to evaluate appropriate tests
2750
     experiments.  The functions can be used to evaluate appropriate tests
2745
     of contrast and perform single outlier detection.
2751
     of contrast and perform single outlier detection.
2746
 
2752
 
2747
*gcrma*
2753
*gcrma*
2748
     Background adjustment using sequence information.
2754
     Background adjustment using sequence information.
2749
 
2755
 
2750
*genefilter*
2756
*genefilter*
2751
     Tools for sequentially filtering genes using a wide variety of
2757
     Tools for sequentially filtering genes using a wide variety of
2752
     filtering functions.  Example of filters include: number of missing
2758
     filtering functions.  Example of filters include: number of missing
2753
     value, coefficient of variation of expression measures, ANOVA p-value,
2759
     value, coefficient of variation of expression measures, ANOVA p-value,
2754
     Cox model p-values.  Sequential application of filtering functions to
2760
     Cox model p-values.  Sequential application of filtering functions to
2755
     genes.
2761
     genes.
2756
 
2762
 
2757
*geneplotter*
2763
*geneplotter*
2758
     Graphical tools for genomic data, for example for plotting expression
2764
     Graphical tools for genomic data, for example for plotting expression
2759
     data along a chromosome or producing color images of expression data
2765
     data along a chromosome or producing color images of expression data
2760
     matrices.
2766
     matrices.
2761
 
2767
 
2762
*globaltest*
2768
*globaltest*
2763
     Testing globally whether a group of genes is significantly related to
2769
     Testing globally whether a group of genes is significantly related to
2764
     some clinical variable of interest.
2770
     some clinical variable of interest.
2765
 
2771
 
2766
*gpls*
2772
*gpls*
2767
     Classification using generalized partial least squares for two-group
2773
     Classification using generalized partial least squares for two-group
2768
     and multi-group classification.
2774
     and multi-group classification.
2769
 
2775
 
2770
*graph*
2776
*graph*
2771
     Classes and tools for creating and manipulating graphs within R.
2777
     Classes and tools for creating and manipulating graphs within R.
2772
 
2778
 
2773
*hexbin*
2779
*hexbin*
2774
     Binning functions, in particular hexagonal bins for graphing.
2780
     Binning functions, in particular hexagonal bins for graphing.
2775
 
2781
 
2776
*limma*
2782
*limma*
2777
     Linear models for microarray data.
2783
     Linear models for microarray data.
2778
 
2784
 
2779
*makecdfenv*
2785
*makecdfenv*
2780
     Two functions.  One reads a Affymetrix chip description file (CDF) and
2786
     Two functions.  One reads a Affymetrix chip description file (CDF) and
2781
     creates a hash table environment containing the location/probe set
2787
     creates a hash table environment containing the location/probe set
2782
     membership mapping.  The other creates a package that automatically
2788
     membership mapping.  The other creates a package that automatically
2783
     loads that environment.
2789
     loads that environment.
2784
 
2790
 
2785
*marrayClasses*
2791
*marrayClasses*
2786
     Class definitions for pre-normalized and normalized cDNA microarray
2792
     Class definitions for pre-normalized and normalized cDNA microarray
2787
     data.  Basic methods for accessing/replacing, printing, and subsetting.
2793
     data.  Basic methods for accessing/replacing, printing, and subsetting.
2788
 
2794
 
2789
*marrayInput*
2795
*marrayInput*
2790
     Functions for reading microarray data into R from different image
2796
     Functions for reading microarray data into R from different image
2791
     analysis output files, and probe and target description files.  Widgets
2797
     analysis output files, and probe and target description files.  Widgets
2792
     are supplied to facilitate and automate data input and the creation of
2798
     are supplied to facilitate and automate data input and the creation of
2793
     microarray specific R objects for storing these data.
2799
     microarray specific R objects for storing these data.
2794
 
2800
 
2795
*marrayNorm*
2801
*marrayNorm*
2796
     Functions for location and scale normalization procedures based on
2802
     Functions for location and scale normalization procedures based on
2797
     robust local regression.
2803
     robust local regression.
2798
 
2804
 
2799
*marrayPlots*
2805
*marrayPlots*
2800
     Functions for diagnostic plots for pre- and post-normalization cDNA
2806
     Functions for diagnostic plots for pre- and post-normalization cDNA
2801
     microarray intensity data: boxplots, scatter-plots, color images.
2807
     microarray intensity data: boxplots, scatter-plots, color images.
2802
 
2808
 
2803
*marrayTools*
2809
*marrayTools*
2804
     Miscellaneous functions used in the functional genomics core facility
2810
     Miscellaneous functions used in the functional genomics core facility
2805
     in UCB and UCSF.
2811
     in UCB and UCSF.
2806
 
2812
 
2807
*matchprobes*
2813
*matchprobes*
2808
     ools for sequence matching of probes on arrays.
2814
     ools for sequence matching of probes on arrays.
2809
 
2815
 
2810
*multtest*
2816
*multtest*
2811
     Multiple testing procedures for controlling the family-wise error rate
2817
     Multiple testing procedures for controlling the family-wise error rate
2812
     (FWER) and the false discovery rate (FDR).  Tests can be based on t-
2818
     (FWER) and the false discovery rate (FDR).  Tests can be based on t-
2813
     or F-statistics for one- and two-factor designs, and permutation
2819
     or F-statistics for one- and two-factor designs, and permutation
2814
     procedures are available to estimate adjusted p-values.
2820
     procedures are available to estimate adjusted p-values.
2815
 
2821
 
2816
*ontoTools*
2822
*ontoTools*
2817
     Graphs and sparse matrices for working with ontologies.
2823
     Graphs and sparse matrices for working with ontologies.
2818
 
2824
 
2819
*pamr*
2825
*pamr*
2820
     Pam: prediction analysis for microarrays.
2826
     Pam: prediction analysis for microarrays.
2821
 
2827
 
2822
*reposTools*
2828
*reposTools*
2823
     Tools for dealing with file repositories and allow users to easily
2829
     Tools for dealing with file repositories and allow users to easily
2824
     install, update, and distribute packages, vignettes, and other files.
2830
     install, update, and distribute packages, vignettes, and other files.
2825
 
2831
 
2826
*rhdf5*
2832
*rhdf5*
2827
     Storage and retrieval of large datasets using the HDF5 library and file
2833
     Storage and retrieval of large datasets using the HDF5 library and file
2828
     format.
2834
     format.
2829
 
2835
 
2830
*siggenes*
2836
*siggenes*
2831
     Identifying differentially expressed genes and estimating the False
2837
     Identifying differentially expressed genes and estimating the False
2832
     Discovery Rate (FDR) with both the Significance Analysis of Microarrays
2838
     Discovery Rate (FDR) with both the Significance Analysis of Microarrays
2833
     (SAM) and the Empirical Bayes Analyses of Microarrays (EBAM).
2839
     (SAM) and the Empirical Bayes Analyses of Microarrays (EBAM).
2834
 
2840
 
2835
*splicegear*
2841
*splicegear*
2836
     A set of tools to work with alternative splicing.
2842
     A set of tools to work with alternative splicing.
2837
 
2843
 
2838
*tkWidgets*
2844
*tkWidgets*
2839
     Widgets in Tcl/Tk that provide functionality for Bioconductor packages.
2845
     Widgets in Tcl/Tk that provide functionality for Bioconductor packages.
2840
 
2846
 
2841
*vsn*
2847
*vsn*
2842
     Calibration and variance stabilizing transformations for both
2848
     Calibration and variance stabilizing transformations for both
2843
     Affymetrix and cDNA array data.
2849
     Affymetrix and cDNA array data.
2844
 
2850
 
2845
*widgetTools*
2851
*widgetTools*
2846
     Tools for creating Tcl/Tk widgets, i.e., small-scale graphical user
2852
     Tools for creating Tcl/Tk widgets, i.e., small-scale graphical user
2847
     interfaces.
2853
     interfaces.
2848
 
2854
 
2849
5.1.5 Other add-on packages
2855
5.1.5 Other add-on packages
2850
---------------------------
2856
---------------------------
2851
 
2857
 
2852
Jim Lindsey <jlindsey@luc.ac.be> has written a collection of R packages for
2858
Jim Lindsey <jlindsey@luc.ac.be> has written a collection of R packages for
2853
nonlinear regression and repeated measurements, consisting of *event*
2859
nonlinear regression and repeated measurements, consisting of *event*
2854
(event history procedures and models), *gnlm* (generalized nonlinear
2860
(event history procedures and models), *gnlm* (generalized nonlinear
2855
regression models), *growth* (multivariate normal and
2861
regression models), *growth* (multivariate normal and
2856
elliptically-contoured repeated measurements models), *repeated*
2862
elliptically-contoured repeated measurements models), *repeated*
2857
(non-normal repeated measurements models), *rmutil* (utilities for
2863
(non-normal repeated measurements models), *rmutil* (utilities for
2858
nonlinear regression and repeated measurements), and *stable* (probability
2864
nonlinear regression and repeated measurements), and *stable* (probability
2859
functions and generalized regression models for stable distributions).  All
2865
functions and generalized regression models for stable distributions).  All
2860
analyses in the new edition of his book "Models for Repeated Measurements"
2866
analyses in the new edition of his book "Models for Repeated Measurements"
2861
(1999, Oxford University Press) were carried out using these packages.  Jim
2867
(1999, Oxford University Press) were carried out using these packages.  Jim
2862
has also started *dna*, a package with procedures for the analysis of DNA
2868
has also started *dna*, a package with procedures for the analysis of DNA
2863
sequences.  Jim's packages can be obtained from
2869
sequences.  Jim's packages can be obtained from
2864
`http://www.luc.ac.be/~jlindsey/rcode.html'.
2870
`http://www.luc.ac.be/~jlindsey/rcode.html'.
2865
 
2871
 
2866
   More code has been posted to the R-help mailing list, and can be
2872
   More code has been posted to the R-help mailing list, and can be
2867
obtained from the mailing list archive.
2873
obtained from the mailing list archive.
2868
 
2874
 
2869
5.2 How can add-on packages be installed?
2875
5.2 How can add-on packages be installed?
2870
=========================================
2876
=========================================
2871
 
2877
 
2872
(Unix only.)  The add-on packages on CRAN come as gzipped tar files named
2878
(Unix only.)  The add-on packages on CRAN come as gzipped tar files named
2873
`PKG_VERSION.tar.gz', which may in fact be "bundles" containing more than
2879
`PKG_VERSION.tar.gz', which may in fact be "bundles" containing more than
2874
one package.  Provided that `tar' and `gzip' are available on your system,
2880
one package.  Provided that `tar' and `gzip' are available on your system,
2875
type
2881
type
2876
 
2882
 
2877
     $ R CMD INSTALL /path/to/PKG_VERSION.tar.gz
2883
     $ R CMD INSTALL /path/to/PKG_VERSION.tar.gz
2878
 
2884
 
2879
at the shell prompt to install to the library tree rooted at the first
2885
at the shell prompt to install to the library tree rooted at the first
2880
directory given in `R_LIBS' (see below) if this is set and non-null, and to
2886
directory given in `R_LIBS' (see below) if this is set and non-null, and to
2881
the default library (the `library' subdirectory of ``R_HOME'') otherwise.
2887
the default library (the `library' subdirectory of ``R_HOME'') otherwise.
2882
(Versions of R prior to 1.3.0 installed to the default library by default.)
2888
(Versions of R prior to 1.3.0 installed to the default library by default.)
2883
 
2889
 
2884
   To install to another tree (e.g., your private one), use
2890
   To install to another tree (e.g., your private one), use
2885
 
2891
 
2886
     $ R CMD INSTALL -l LIB /path/to/PKG_VERSION.tar.gz
2892
     $ R CMD INSTALL -l LIB /path/to/PKG_VERSION.tar.gz
2887
 
2893
 
2888
where LIB gives the path to the library tree to install to.
2894
where LIB gives the path to the library tree to install to.
2889
 
2895
 
2890
   Even more conveniently, you can install and automatically update
2896
   Even more conveniently, you can install and automatically update
2891
packages from within R if you have access to CRAN.  See the help page for
2897
packages from within R if you have access to CRAN.  See the help page for
2892
`CRAN.packages()' for more information.
2898
`CRAN.packages()' for more information.
2893
 
2899
 
2894
   You can use several library trees of add-on packages.  The easiest way
2900
   You can use several library trees of add-on packages.  The easiest way
2895
to tell R to use these is via the environment variable `R_LIBS' which
2901
to tell R to use these is via the environment variable `R_LIBS' which
2896
should be a colon-separated list of directories at which R library trees
2902
should be a colon-separated list of directories at which R library trees
2897
are rooted.  You do not have to specify the default tree in `R_LIBS'.
2903
are rooted.  You do not have to specify the default tree in `R_LIBS'.
2898
E.g., to use a private tree in `$HOME/lib/R' and a public site-wide tree in
2904
E.g., to use a private tree in `$HOME/lib/R' and a public site-wide tree in
2899
`/usr/local/lib/R-contrib', put
2905
`/usr/local/lib/R-contrib', put
2900
 
2906
 
2901
     R_LIBS="$HOME/lib/R:/usr/local/lib/R-contrib"; export R_LIBS
2907
     R_LIBS="$HOME/lib/R:/usr/local/lib/R-contrib"; export R_LIBS
2902
 
2908
 
2903
into your (Bourne) shell profile or even preferably, add the line
2909
into your (Bourne) shell profile or even preferably, add the line
2904
 
2910
 
2905
     R_LIBS="$HOME/lib/R:/usr/local/lib/R-contrib"
2911
     R_LIBS="$HOME/lib/R:/usr/local/lib/R-contrib"
2906
 
2912
 
2907
your `~/.Renviron' file.  (Note that no `export' statement is needed or
2913
your `~/.Renviron' file.  (Note that no `export' statement is needed or
2908
allowed in this file; see the on-line help for `Startup' for more
2914
allowed in this file; see the on-line help for `Startup' for more
2909
information.)
2915
information.)
2910
 
2916
 
2911
5.3 How can add-on packages be used?
2917
5.3 How can add-on packages be used?
2912
====================================
2918
====================================
2913
 
2919
 
2914
To find out which additional packages are available on your system, type
2920
To find out which additional packages are available on your system, type
2915
 
2921
 
2916
     library()
2922
     library()
2917
 
2923
 
2918
at the R prompt.
2924
at the R prompt.
2919
 
2925
 
2920
   This produces something like
2926
   This produces something like
2921
 
2927
 
2922
     Packages in `/home/me/lib/R':
2928
     Packages in `/home/me/lib/R':
2923
     
2929
     
2924
     mystuff       My own R functions, nicely packaged but not documented
2930
     mystuff       My own R functions, nicely packaged but not documented
2925
     
2931
     
2926
     Packages in `/usr/local/lib/R/library':
2932
     Packages in `/usr/local/lib/R/library':
2927
     
2933
     
2928
     KernSmooth    Functions for kernel smoothing for Wand & Jones (1995)
2934
     KernSmooth    Functions for kernel smoothing for Wand & Jones (1995)
2929
     MASS          Main Library of Venables and Ripley's MASS
2935
     MASS          Main Library of Venables and Ripley's MASS
2930
     base          The R base package
2936
     base          The R base package
2931
     boot          Bootstrap R (S-Plus) Functions (Canty)
2937
     boot          Bootstrap R (S-Plus) Functions (Canty)
2932
     class         Functions for classification
2938
     class         Functions for classification
2933
     cluster       Functions for clustering (by Rousseeuw et al.)
2939
     cluster       Functions for clustering (by Rousseeuw et al.)
2934
     ctest         Classical Tests
2940
     ctest         Classical Tests
2935
     eda           Exploratory Data Analysis
2941
     eda           Exploratory Data Analysis
2936
     foreign       Read data stored by Minitab, S, SAS, SPSS, Stata, ...
2942
     foreign       Read data stored by Minitab, S, SAS, SPSS, Stata, ...
2937
     grid          The Grid Graphics Package
2943
     grid          The Grid Graphics Package
2938
     lattice       Lattice Graphics
2944
     lattice       Lattice Graphics
2939
     lqs           Resistant Regression and Covariance Estimation
2945
     lqs           Resistant Regression and Covariance Estimation
2940
     methods       Formal Methods and Classes
2946
     methods       Formal Methods and Classes
2941
     mle           Maximum likelihood estimation
2947
     mle           Maximum likelihood estimation
2942
     mgcv          Multiple smoothing parameter estimation and GAMs by GCV
2948
     mgcv          Multiple smoothing parameter estimation and GAMs by GCV
2943
     modreg        Modern Regression: Smoothing and Local Methods
2949
     modreg        Modern Regression: Smoothing and Local Methods
2944
     mva           Classical Multivariate Analysis
2950
     mva           Classical Multivariate Analysis
2945
     nlme          Linear and nonlinear mixed effects models
2951
     nlme          Linear and nonlinear mixed effects models
2946
     nls           Nonlinear regression
2952
     nls           Nonlinear regression
2947
     nnet          Feed-forward neural networks and multinomial log-linear
2953
     nnet          Feed-forward neural networks and multinomial log-linear
2948
                   models
2954
                   models
2949
     rpart         Recursive partitioning
2955
     rpart         Recursive partitioning
2950
     spatial       functions for kriging and point pattern analysis
2956
     spatial       functions for kriging and point pattern analysis
2951
     splines       Regression Spline Functions and Classes
2957
     splines       Regression Spline Functions and Classes
2952
     stepfun       Step Functions, including Empirical Distributions
2958
     stepfun       Step Functions, including Empirical Distributions
2953
     survival      Survival analysis, including penalised likelihood
2959
     survival      Survival analysis, including penalised likelihood
2954
     tcltk         Tcl/Tk Interface
2960
     tcltk         Tcl/Tk Interface
2955
     tools         Tools for Package Development and Administration
2961
     tools         Tools for Package Development and Administration
2956
     ts            Time series functions
2962
     ts            Time series functions
2957
 
2963
 
2958
   You can "load" the installed package PKG by
2964
   You can "load" the installed package PKG by
2959
 
2965
 
2960
     library(PKG)
2966
     library(PKG)
2961
 
2967
 
2962
   You can then find out which functions it provides by typing one of
2968
   You can then find out which functions it provides by typing one of
2963
 
2969
 
2964
     library(help = PKG)
2970
     library(help = PKG)
2965
     help(package = PKG)
2971
     help(package = PKG)
2966
 
2972
 
2967
   You can unload the loaded package PKG by
2973
   You can unload the loaded package PKG by
2968
 
2974
 
2969
     detach("package:PKG")
2975
     detach("package:PKG")
2970
 
2976
 
2971
5.4 How can add-on packages be removed?
2977
5.4 How can add-on packages be removed?
2972
=======================================
2978
=======================================
2973
 
2979
 
2974
Use
2980
Use
2975
 
2981
 
2976
     $ R CMD REMOVE PKG_1 ... PKG_N
2982
     $ R CMD REMOVE PKG_1 ... PKG_N
2977
 
2983
 
2978
to remove the packages PKG_1, ..., PKG_N from the library tree rooted at
2984
to remove the packages PKG_1, ..., PKG_N from the library tree rooted at
2979
the first directory given in `R_LIBS' if this is set and non-null, and from
2985
the first directory given in `R_LIBS' if this is set and non-null, and from
2980
the default library otherwise.  (Versions of R prior to 1.3.0 removed from
2986
the default library otherwise.  (Versions of R prior to 1.3.0 removed from
2981
the default library by default.)
2987
the default library by default.)
2982
 
2988
 
2983
   To remove from library LIB, do
2989
   To remove from library LIB, do
2984
 
2990
 
2985
     $ R CMD REMOVE -l LIB PKG_1 ... PKG_N
2991
     $ R CMD REMOVE -l LIB PKG_1 ... PKG_N
2986
 
2992
 
2987
5.5 How can I create an R package?
2993
5.5 How can I create an R package?
2988
==================================
2994
==================================
2989
 
2995
 
2990
A package consists of a subdirectory containing the files `DESCRIPTION' and
2996
A package consists of a subdirectory containing the files `DESCRIPTION' and
2991
`INDEX', and the subdirectories `R', `data', `demo', `exec', `inst', `man',
2997
`INDEX', and the subdirectories `R', `data', `demo', `exec', `inst', `man',
2992
`src', and `tests' (some of which can be missing).  Optionally the package
2998
`src', and `tests' (some of which can be missing).  Optionally the package
2993
can also contain script files `configure' and `cleanup' which are executed
2999
can also contain script files `configure' and `cleanup' which are executed
2994
before and after installation.
3000
before and after installation.
2995
 
3001
 
2996
   See section "Creating R packages" in `Writing R Extensions', for details.
3002
   See section "Creating R packages" in `Writing R Extensions', for details.
2997
This manual is included in the R distribution, *note What documentation
3003
This manual is included in the R distribution, *note What documentation
2998
exists for R?::, and gives information on package structure, the configure
3004
exists for R?::, and gives information on package structure, the configure
2999
and cleanup mechanisms, and on automated package checking and building.
3005
and cleanup mechanisms, and on automated package checking and building.
3000
 
3006
 
3001
   R version 1.3.0 has added the function `package.skeleton()' which will
3007
   R version 1.3.0 has added the function `package.skeleton()' which will
3002
set up directories, save data and code, and create skeleton help files for
3008
set up directories, save data and code, and create skeleton help files for
3003
a set of R functions and datasets.
3009
a set of R functions and datasets.
3004
 
3010
 
3005
   *Note What is CRAN?::, for information on uploading a package to CRAN.
3011
   *Note What is CRAN?::, for information on uploading a package to CRAN.
3006
 
3012
 
3007
5.6 How can I contribute to R?
3013
5.6 How can I contribute to R?
3008
==============================
3014
==============================
3009
 
3015
 
3010
R is in active development and there is always a risk of bugs creeping in.
3016
R is in active development and there is always a risk of bugs creeping in.
3011
Also, the developers do not have access to all possible machines capable of
3017
Also, the developers do not have access to all possible machines capable of
3012
running R.  So, simply using it and communicating problems is certainly of
3018
running R.  So, simply using it and communicating problems is certainly of
3013
great value.
3019
great value.
3014
 
3020
 
3015
   One place where functionality is still missing is the modeling software
3021
   One place where functionality is still missing is the modeling software
3016
as described in "Statistical Models in S" (see *Note What is S?::);
3022
as described in "Statistical Models in S" (see *Note What is S?::);
3017
Generalized Additive Models (*note Are GAMs implemented in R?::) and some
3023
Generalized Additive Models (*note Are GAMs implemented in R?::) and some
3018
of the nonlinear modeling code are not there yet.
3024
of the nonlinear modeling code are not there yet.
3019
 
3025
 
3020
   The R Developer Page (http://developer.R-project.org/) acts as an
3026
   The R Developer Page (http://developer.R-project.org/) acts as an
3021
intermediate repository for more or less finalized ideas and plans for the
3027
intermediate repository for more or less finalized ideas and plans for the
3022
R statistical system.  It contains (pointers to) TODO lists, RFCs, various
3028
R statistical system.  It contains (pointers to) TODO lists, RFCs, various
3023
other writeups, ideas lists, and CVS miscellanea.
3029
other writeups, ideas lists, and CVS miscellanea.
3024
 
3030
 
3025
   Many (more) of the packages available at the Statlib S Repository might
3031
   Many (more) of the packages available at the Statlib S Repository might
3026
be worth porting to R.
3032
be worth porting to R.
3027
 
3033
 
3028
   If you are interested in working on any of these projects, please notify
3034
   If you are interested in working on any of these projects, please notify
3029
Kurt Hornik <Kurt.Hornik@R-project.org>.
3035
Kurt Hornik <Kurt.Hornik@R-project.org>.
3030
 
3036
 
3031
6 R and Emacs
3037
6 R and Emacs
3032
*************
3038
*************
3033
 
3039
 
3034
6.1 Is there Emacs support for R?
3040
6.1 Is there Emacs support for R?
3035
=================================
3041
=================================
3036
 
3042
 
3037
There is an Emacs package called ESS ("Emacs Speaks Statistics") which
3043
There is an Emacs package called ESS ("Emacs Speaks Statistics") which
3038
provides a standard interface between statistical programs and statistical
3044
provides a standard interface between statistical programs and statistical
3039
processes.  It is intended to provide assistance for interactive
3045
processes.  It is intended to provide assistance for interactive
3040
statistical programming and data analysis.  Languages supported include: S
3046
statistical programming and data analysis.  Languages supported include: S
3041
dialects (S 3/4, S-PLUS 3.x/4.x/5.x, and R), LispStat dialects (XLispStat,
3047
dialects (S 3/4, S-PLUS 3.x/4.x/5.x, and R), LispStat dialects (XLispStat,
3042
ViSta) and SAS.  Stata and SPSS dialect (SPSS, PSPP) support is being
3048
ViSta) and SAS.  Stata and SPSS dialect (SPSS, PSPP) support is being
3043
examined for possible future implementation
3049
examined for possible future implementation
3044
 
3050
 
3045
   ESS grew out of the need for bug fixes and extensions to S-mode 4.8
3051
   ESS grew out of the need for bug fixes and extensions to S-mode 4.8
3046
(which was a GNU Emacs interface to S/S-PLUS version 3 only).  The current
3052
(which was a GNU Emacs interface to S/S-PLUS version 3 only).  The current
3047
set of developers desired support for XEmacs, R, S4, and MS Windows.  In
3053
set of developers desired support for XEmacs, R, S4, and MS Windows.  In
3048
addition, with new modes being developed for R, Stata, and SAS, it was felt
3054
addition, with new modes being developed for R, Stata, and SAS, it was felt
3049
that a unifying interface and framework for the user interface would
3055
that a unifying interface and framework for the user interface would
3050
benefit both the user and the developer, by helping both groups conform to
3056
benefit both the user and the developer, by helping both groups conform to
3051
standard Emacs usage.  The end result is an increase in efficiency for
3057
standard Emacs usage.  The end result is an increase in efficiency for
3052
statistical programming and data analysis, over the usual tools.
3058
statistical programming and data analysis, over the usual tools.
3053
 
3059
 
3054
   R support contains code for editing R source code (syntactic indentation
3060
   R support contains code for editing R source code (syntactic indentation
3055
and highlighting of source code, partial evaluations of code, loading and
3061
and highlighting of source code, partial evaluations of code, loading and
3056
error-checking of code, and source code revision maintenance) and
3062
error-checking of code, and source code revision maintenance) and
3057
documentation (syntactic indentation and highlighting of source code,
3063
documentation (syntactic indentation and highlighting of source code,
3058
sending examples to running ESS process, and previewing), interacting with
3064
sending examples to running ESS process, and previewing), interacting with
3059
an inferior R process from within Emacs (command-line editing, searchable
3065
an inferior R process from within Emacs (command-line editing, searchable
3060
command history, command-line completion of R object and file names, quick
3066
command history, command-line completion of R object and file names, quick
3061
access to object and search lists, transcript recording, and an interface
3067
access to object and search lists, transcript recording, and an interface
3062
to the help system), and transcript manipulation (recording and saving
3068
to the help system), and transcript manipulation (recording and saving
3063
transcript files, manipulating and editing saved transcripts, and
3069
transcript files, manipulating and editing saved transcripts, and
3064
re-evaluating commands from transcript files).
3070
re-evaluating commands from transcript files).
3065
 
3071
 
3066
   The latest stable version of ESS are available via CRAN or the ESS web
3072
   The latest stable version of ESS are available via CRAN or the ESS web
3067
page (http://ESS.R-project.org/).  The HTML version of the documentation
3073
page (http://ESS.R-project.org/).  The HTML version of the documentation
3068
can be found at `http://stat.ethz.ch/ESS/'.
3074
can be found at `http://stat.ethz.ch/ESS/'.
3069
 
3075
 
3070
   ESS comes with detailed installation instructions.
3076
   ESS comes with detailed installation instructions.
3071
 
3077
 
3072
   For help with ESS, send email to <ESS-help@stat.ethz.ch>.
3078
   For help with ESS, send email to <ESS-help@stat.ethz.ch>.
3073
 
3079
 
3074
   Please send bug reports and suggestions on ESS to
3080
   Please send bug reports and suggestions on ESS to
3075
<ESS-bugs@stat.math.ethz.ch>.  The easiest way to do this from is within
3081
<ESS-bugs@stat.math.ethz.ch>.  The easiest way to do this from is within
3076
Emacs by typing `M-x ess-submit-bug-report' or using the [ESS] or [iESS]
3082
Emacs by typing `M-x ess-submit-bug-report' or using the [ESS] or [iESS]
3077
pulldown menus.
3083
pulldown menus.
3078
 
3084
 
3079
6.2 Should I run R from within Emacs?
3085
6.2 Should I run R from within Emacs?
3080
=====================================
3086
=====================================
3081
 
3087
 
3082
Yes, _definitely_.  Inferior R mode provides a readline/history mechanism,
3088
Yes, _definitely_.  Inferior R mode provides a readline/history mechanism,
3083
object name completion, and syntax-based highlighting of the interaction
3089
object name completion, and syntax-based highlighting of the interaction
3084
buffer using Font Lock mode, as well as a very convenient interface to the
3090
buffer using Font Lock mode, as well as a very convenient interface to the
3085
R help system.
3091
R help system.
3086
 
3092
 
3087
   Of course, it also integrates nicely with the mechanisms for editing R
3093
   Of course, it also integrates nicely with the mechanisms for editing R
3088
source using Emacs.  One can write code in one Emacs buffer and send whole
3094
source using Emacs.  One can write code in one Emacs buffer and send whole
3089
or parts of it for execution to R; this is helpful for both data analysis
3095
or parts of it for execution to R; this is helpful for both data analysis
3090
and programming.  One can also seamlessly integrate with a revision control
3096
and programming.  One can also seamlessly integrate with a revision control
3091
system, in order to maintain a log of changes in your programs and data, as
3097
system, in order to maintain a log of changes in your programs and data, as
3092
well as to allow for the retrieval of past versions of the code.
3098
well as to allow for the retrieval of past versions of the code.
3093
 
3099
 
3094
   In addition, it allows you to keep a record of your session, which can
3100
   In addition, it allows you to keep a record of your session, which can
3095
also be used for error recovery through the use of the transcript mode.
3101
also be used for error recovery through the use of the transcript mode.
3096
 
3102
 
3097
   To specify command line arguments for the inferior R process, use `C-u
3103
   To specify command line arguments for the inferior R process, use `C-u
3098
M-x R' for starting R.
3104
M-x R' for starting R.
3099
 
3105
 
3100
6.3 Debugging R from within Emacs
3106
6.3 Debugging R from within Emacs
3101
=================================
3107
=================================
3102
 
3108
 
3103
To debug R "from within Emacs", there are several possibilities.  To use
3109
To debug R "from within Emacs", there are several possibilities.  To use
3104
the Emacs GUD (Grand Unified Debugger) library with the recommended
3110
the Emacs GUD (Grand Unified Debugger) library with the recommended
3105
debugger GDB, type `M-x gdb' and give the path to the R _binary_ as
3111
debugger GDB, type `M-x gdb' and give the path to the R _binary_ as
3106
argument.  At the `gdb' prompt, set `R_HOME' and other environment
3112
argument.  At the `gdb' prompt, set `R_HOME' and other environment
3107
variables as needed (using e.g.  `set env R_HOME /path/to/R/', but see also
3113
variables as needed (using e.g.  `set env R_HOME /path/to/R/', but see also
3108
below), and start the binary with the desired arguments (e.g., `run
3114
below), and start the binary with the desired arguments (e.g., `run
3109
--quiet').
3115
--quiet').
3110
 
3116
 
3111
   If you have ESS, you can do `C-u M-x R <RET> - d <SPC> g d b <RET>' to
3117
   If you have ESS, you can do `C-u M-x R <RET> - d <SPC> g d b <RET>' to
3112
start an inferior R process with arguments `-d gdb'.
3118
start an inferior R process with arguments `-d gdb'.
3113
 
3119
 
3114
   A third option is to start an inferior R process via ESS (`M-x R') and
3120
   A third option is to start an inferior R process via ESS (`M-x R') and
3115
then start GUD (`M-x gdb') giving the R binary (using its full path name)
3121
then start GUD (`M-x gdb') giving the R binary (using its full path name)
3116
as the program to debug.  Use the program `ps' to find the process number
3122
as the program to debug.  Use the program `ps' to find the process number
3117
of the currently running R process then use the `attach' command in gdb to
3123
of the currently running R process then use the `attach' command in gdb to
3118
attach it to that process.  One advantage of this method is that you have
3124
attach it to that process.  One advantage of this method is that you have
3119
separate `*R*' and `*gud-gdb*' windows.  Within the `*R*' window you have
3125
separate `*R*' and `*gud-gdb*' windows.  Within the `*R*' window you have
3120
all the ESS facilities, such as object-name completion, that we know and
3126
all the ESS facilities, such as object-name completion, that we know and
3121
love.
3127
love.
3122
 
3128
 
3123
   When using GUD mode for debugging from within Emacs, you may find it
3129
   When using GUD mode for debugging from within Emacs, you may find it
3124
most convenient to use the directory with your code in it as the current
3130
most convenient to use the directory with your code in it as the current
3125
working directory and then make a symbolic link from that directory to the
3131
working directory and then make a symbolic link from that directory to the
3126
R binary.  That way `.gdbinit' can stay in the directory with the code and
3132
R binary.  That way `.gdbinit' can stay in the directory with the code and
3127
be used to set up the environment and the search paths for the source, e.g.
3133
be used to set up the environment and the search paths for the source, e.g.
3128
as follows:
3134
as follows:
3129
 
3135
 
3130
     set env R_HOME /opt/R
3136
     set env R_HOME /opt/R
3131
     set env R_PAPERSIZE letter
3137
     set env R_PAPERSIZE letter
3132
     set env R_PRINTCMD lpr
3138
     set env R_PRINTCMD lpr
3133
     dir /opt/R/src/appl
3139
     dir /opt/R/src/appl
3134
     dir /opt/R/src/main
3140
     dir /opt/R/src/main
3135
     dir /opt/R/src/nmath
3141
     dir /opt/R/src/nmath
3136
     dir /opt/R/src/unix
3142
     dir /opt/R/src/unix
3137
 
3143
 
3138
7 R Miscellanea
3144
7 R Miscellanea
3139
***************
3145
***************
3140
 
3146
 
3141
7.1 Why does R run out of memory?
3147
7.1 Why does R run out of memory?
3142
=================================
3148
=================================
3143
 
3149
 
3144
Versions of R prior to 1.2.0 used a _static_ memory model.  At startup, R
3150
Versions of R prior to 1.2.0 used a _static_ memory model.  At startup, R
3145
asked the operating system to reserve a fixed amount of memory for it.  The
3151
asked the operating system to reserve a fixed amount of memory for it.  The
3146
size of this chunk could not be changed subsequently.  Hence, it could
3152
size of this chunk could not be changed subsequently.  Hence, it could
3147
happen that not enough memory was allocated, e.g., when trying to read
3153
happen that not enough memory was allocated, e.g., when trying to read
3148
large data sets into R.  In such cases, it was necessary to restart R with
3154
large data sets into R.  In such cases, it was necessary to restart R with
3149
more memory available, as controlled by the command line options `--nsize'
3155
more memory available, as controlled by the command line options `--nsize'
3150
and `--vsize'.
3156
and `--vsize'.
3151
 
3157
 
3152
   R version 1.2.0 introduces a new "generational" garbage collector, which
3158
   R version 1.2.0 introduces a new "generational" garbage collector, which
3153
will increase the memory available to R as needed.  Hence, user
3159
will increase the memory available to R as needed.  Hence, user
3154
intervention is no longer necessary for ensuring that enough memory is
3160
intervention is no longer necessary for ensuring that enough memory is
3155
available.
3161
available.
3156
 
3162
 
3157
   The new garbage collector does not move objects in memory, meaning that
3163
   The new garbage collector does not move objects in memory, meaning that
3158
it is possible for the free memory to become fragmented so that large
3164
it is possible for the free memory to become fragmented so that large
3159
objects cannot be allocated even when there is apparently enough memory for
3165
objects cannot be allocated even when there is apparently enough memory for
3160
them.
3166
them.
3161
 
3167
 
3162
7.2 Why does sourcing a correct file fail?
3168
7.2 Why does sourcing a correct file fail?
3163
==========================================
3169
==========================================
3164
 
3170
 
3165
Versions of R prior to 1.2.1 may have had problems parsing files not ending
3171
Versions of R prior to 1.2.1 may have had problems parsing files not ending
3166
in a newline.  Earlier R versions had a similar problem when reading in
3172
in a newline.  Earlier R versions had a similar problem when reading in
3167
data files.  This should no longer happen.
3173
data files.  This should no longer happen.
3168
 
3174
 
3169
7.3 How can I set components of a list to NULL?
3175
7.3 How can I set components of a list to NULL?
3170
===============================================
3176
===============================================
3171
 
3177
 
3172
You can use
3178
You can use
3173
 
3179
 
3174
     x[i] <- list(NULL)
3180
     x[i] <- list(NULL)
3175
 
3181
 
3176
to set component `i' of the list `x' to `NULL', similarly for named
3182
to set component `i' of the list `x' to `NULL', similarly for named
3177
components.  Do not set `x[i]' or `x[[i]]' to `NULL', because this will
3183
components.  Do not set `x[i]' or `x[[i]]' to `NULL', because this will
3178
remove the corresponding component from the list.
3184
remove the corresponding component from the list.
3179
 
3185
 
3180
   For dropping the row names of a matrix `x', it may be easier to use
3186
   For dropping the row names of a matrix `x', it may be easier to use
3181
`rownames(x) <- NULL', similarly for column names.
3187
`rownames(x) <- NULL', similarly for column names.
3182
 
3188
 
3183
7.4 How can I save my workspace?
3189
7.4 How can I save my workspace?
3184
================================
3190
================================
3185
 
3191
 
3186
`save.image()' saves the objects in the user's `.GlobalEnv' to the file
3192
`save.image()' saves the objects in the user's `.GlobalEnv' to the file
3187
`.RData' in the R startup directory.  (This is also what happens after
3193
`.RData' in the R startup directory.  (This is also what happens after
3188
`q("yes")'.)  Using `save.image(FILE)' one can save the image under a
3194
`q("yes")'.)  Using `save.image(FILE)' one can save the image under a
3189
different name.
3195
different name.
3190
 
3196
 
3191
7.5 How can I clean up my workspace?
3197
7.5 How can I clean up my workspace?
3192
====================================
3198
====================================
3193
 
3199
 
3194
To remove all objects in the currently active environment (typically
3200
To remove all objects in the currently active environment (typically
3195
`.GlobalEnv'), you can do
3201
`.GlobalEnv'), you can do
3196
 
3202
 
3197
     rm(list = ls(all = TRUE))
3203
     rm(list = ls(all = TRUE))
3198
 
3204
 
3199
(Without `all = TRUE', only the objects with names not starting with a `.'
3205
(Without `all = TRUE', only the objects with names not starting with a `.'
3200
are removed.)
3206
are removed.)
3201
 
3207
 
3202
7.6 How can I get eval() and D() to work?
3208
7.6 How can I get eval() and D() to work?
3203
=========================================
3209
=========================================
3204
 
3210
 
3205
Strange things will happen if you use `eval(print(x), envir = e)' or
3211
Strange things will happen if you use `eval(print(x), envir = e)' or
3206
`D(x^2, "x")'.  The first one will either tell you that "`x'" is not found,
3212
`D(x^2, "x")'.  The first one will either tell you that "`x'" is not found,
3207
or print the value of the wrong `x'.  The other one will likely return zero
3213
or print the value of the wrong `x'.  The other one will likely return zero
3208
if `x' exists, and an error otherwise.
3214
if `x' exists, and an error otherwise.
3209
 
3215
 
3210
   This is because in both cases, the first argument is evaluated in the
3216
   This is because in both cases, the first argument is evaluated in the
3211
calling environment first.  The result (which should be an object of mode
3217
calling environment first.  The result (which should be an object of mode
3212
`"expression"' or `"call"') is then evaluated or differentiated.  What you
3218
`"expression"' or `"call"') is then evaluated or differentiated.  What you
3213
(most likely) really want is obtained by "quoting" the first argument upon
3219
(most likely) really want is obtained by "quoting" the first argument upon
3214
surrounding it with `expression()'.  For example,
3220
surrounding it with `expression()'.  For example,
3215
 
3221
 
3216
     R> D(expression(x^2), "x")
3222
     R> D(expression(x^2), "x")
3217
     2 * x
3223
     2 * x
3218
 
3224
 
3219
   Although this behavior may initially seem to be rather strange, is
3225
   Although this behavior may initially seem to be rather strange, is
3220
perfectly logical.  The "intuitive" behavior could easily be implemented,
3226
perfectly logical.  The "intuitive" behavior could easily be implemented,
3221
but problems would arise whenever the expression is contained in a
3227
but problems would arise whenever the expression is contained in a
3222
variable, passed as a parameter, or is the result of a function call.
3228
variable, passed as a parameter, or is the result of a function call.
3223
Consider for instance the semantics in cases like
3229
Consider for instance the semantics in cases like
3224
 
3230
 
3225
     D2 <- function(e, n) D(D(e, n), n)
3231
     D2 <- function(e, n) D(D(e, n), n)
3226
 
3232
 
3227
or
3233
or
3228
 
3234
 
3229
     g <- function(y) eval(substitute(y), sys.frame(sys.parent(n = 2)))
3235
     g <- function(y) eval(substitute(y), sys.frame(sys.parent(n = 2)))
3230
     g(a * b)
3236
     g(a * b)
3231
 
3237
 
3232
   See the help page for `deriv()' for more examples.
3238
   See the help page for `deriv()' for more examples.
3233
 
3239
 
3234
7.7 Why do my matrices lose dimensions?
3240
7.7 Why do my matrices lose dimensions?
3235
=======================================
3241
=======================================
3236
 
3242
 
3237
When a matrix with a single row or column is created by a subscripting
3243
When a matrix with a single row or column is created by a subscripting
3238
operation, e.g., `row <- mat[2, ]', it is by default turned into a vector.
3244
operation, e.g., `row <- mat[2, ]', it is by default turned into a vector.
3239
In a similar way if an array with dimension, say, 2 x 3 x 1 x 4 is created
3245
In a similar way if an array with dimension, say, 2 x 3 x 1 x 4 is created
3240
by subscripting it will be coerced into a 2 x 3 x 4 array, losing the
3246
by subscripting it will be coerced into a 2 x 3 x 4 array, losing the
3241
unnecessary dimension.  After much discussion this has been determined to
3247
unnecessary dimension.  After much discussion this has been determined to
3242
be a _feature_.
3248
be a _feature_.
3243
 
3249
 
3244
   To prevent this happening, add the option `drop = FALSE' to the
3250
   To prevent this happening, add the option `drop = FALSE' to the
3245
subscripting.  For example,
3251
subscripting.  For example,
3246
 
3252
 
3247
     rowmatrix <- mat[2, , drop = FALSE]  # creates a row matrix
3253
     rowmatrix <- mat[2, , drop = FALSE]  # creates a row matrix
3248
     colmatrix <- mat[, 2, drop = FALSE]  # creates a column matrix
3254
     colmatrix <- mat[, 2, drop = FALSE]  # creates a column matrix
3249
     a <- b[1, 1, 1, drop = FALSE]        # creates a 1 x 1 x 1 array
3255
     a <- b[1, 1, 1, drop = FALSE]        # creates a 1 x 1 x 1 array
3250
 
3256
 
3251
   The `drop = FALSE' option should be used defensively when programming.
3257
   The `drop = FALSE' option should be used defensively when programming.
3252
For example, the statement
3258
For example, the statement
3253
 
3259
 
3254
     somerows <- mat[index, ]
3260
     somerows <- mat[index, ]
3255
 
3261
 
3256
will return a vector rather than a matrix if `index' happens to have length
3262
will return a vector rather than a matrix if `index' happens to have length
3257
1, causing errors later in the code.  It should probably be rewritten as
3263
1, causing errors later in the code.  It should probably be rewritten as
3258
 
3264
 
3259
     somerows <- mat[index, , drop = FALSE]
3265
     somerows <- mat[index, , drop = FALSE]
3260
 
3266
 
3261
7.8 How does autoloading work?
3267
7.8 How does autoloading work?
3262
==============================
3268
==============================
3263
 
3269
 
3264
R has a special environment called `.AutoloadEnv'.  Using `autoload(NAME,
3270
R has a special environment called `.AutoloadEnv'.  Using `autoload(NAME,
3265
PKG)', where NAME and PKG are strings giving the names of an object and the
3271
PKG)', where NAME and PKG are strings giving the names of an object and the
3266
package containing it, stores some information in this environment.  When R
3272
package containing it, stores some information in this environment.  When R
3267
tries to evaluate NAME, it loads the corresponding package PKG and
3273
tries to evaluate NAME, it loads the corresponding package PKG and
3268
reevaluates NAME in the new package's environment.
3274
reevaluates NAME in the new package's environment.
3269
 
3275
 
3270
   Using this mechanism makes R behave as if the package was loaded, but
3276
   Using this mechanism makes R behave as if the package was loaded, but
3271
does not occupy memory (yet).
3277
does not occupy memory (yet).
3272
 
3278
 
3273
   See the help page for `autoload()' for a very nice example.
3279
   See the help page for `autoload()' for a very nice example.
3274
 
3280
 
3275
7.9 How should I set options?
3281
7.9 How should I set options?
3276
=============================
3282
=============================
3277
 
3283
 
3278
The function `options()' allows setting and examining a variety of global
3284
The function `options()' allows setting and examining a variety of global
3279
"options" which affect the way in which R computes and displays its
3285
"options" which affect the way in which R computes and displays its
3280
results.  The variable `.Options' holds the current values of these
3286
results.  The variable `.Options' holds the current values of these
3281
options, but should never directly be assigned to unless you want to drive
3287
options, but should never directly be assigned to unless you want to drive
3282
yourself crazy--simply pretend that it is a "read-only" variable.
3288
yourself crazy--simply pretend that it is a "read-only" variable.
3283
 
3289
 
3284
   For example, given
3290
   For example, given
3285
 
3291
 
3286
     test1 <- function(x = pi, dig = 3) {
3292
     test1 <- function(x = pi, dig = 3) {
3287
       oo <- options(digits = dig); on.exit(options(oo));
3293
       oo <- options(digits = dig); on.exit(options(oo));
3288
       cat(.Options$digits, x, "\n")
3294
       cat(.Options$digits, x, "\n")
3289
     }
3295
     }
3290
     test2 <- function(x = pi, dig = 3) {
3296
     test2 <- function(x = pi, dig = 3) {
3291
       .Options$digits <- dig
3297
       .Options$digits <- dig
3292
       cat(.Options$digits, x, "\n")
3298
       cat(.Options$digits, x, "\n")
3293
     }
3299
     }
3294
 
3300
 
3295
we obtain:
3301
we obtain:
3296
 
3302
 
3297
     R> test1()
3303
     R> test1()
3298
     3 3.14
3304
     3 3.14
3299
     R> test2()
3305
     R> test2()
3300
     3 3.141593
3306
     3 3.141593
3301
 
3307
 
3302
   What is really used is the _global_ value of `.Options', and using
3308
   What is really used is the _global_ value of `.Options', and using
3303
`options(OPT = VAL)' correctly updates it.  Local copies of `.Options',
3309
`options(OPT = VAL)' correctly updates it.  Local copies of `.Options',
3304
either in `.GlobalEnv' or in a function environment (frame), are just
3310
either in `.GlobalEnv' or in a function environment (frame), are just
3305
silently disregarded.
3311
silently disregarded.
3306
 
3312
 
3307
7.10 How do file names work in Windows?
3313
7.10 How do file names work in Windows?
3308
=======================================
3314
=======================================
3309
 
3315
 
3310
As R uses C-style string handling, `\' is treated as an escape character,
3316
As R uses C-style string handling, `\' is treated as an escape character,
3311
so that for example one can enter a newline as `\n'.  When you really need
3317
so that for example one can enter a newline as `\n'.  When you really need
3312
a `\', you have to escape it with another `\'.
3318
a `\', you have to escape it with another `\'.
3313
 
3319
 
3314
   Thus, in filenames use something like `"c:\\data\\money.dat"'.  You can
3320
   Thus, in filenames use something like `"c:\\data\\money.dat"'.  You can
3315
also replace `\' by `/' (`"c:/data/money.dat"').
3321
also replace `\' by `/' (`"c:/data/money.dat"').
3316
 
3322
 
3317
7.11 Why does plotting give a color allocation error?
3323
7.11 Why does plotting give a color allocation error?
3318
=====================================================
3324
=====================================================
3319
 
3325
 
3320
Sometimes plotting, e.g., when running `demo("image")', results in "Error:
3326
Sometimes plotting, e.g., when running `demo("image")', results in "Error:
3321
color allocation error".  This is an X problem, and only indirectly related
3327
color allocation error".  This is an X problem, and only indirectly related
3322
to R.  It occurs when applications started prior to R have used all the
3328
to R.  It occurs when applications started prior to R have used all the
3323
available colors.  (How many colors are available depends on the X
3329
available colors.  (How many colors are available depends on the X
3324
configuration; sometimes only 256 colors can be used.)
3330
configuration; sometimes only 256 colors can be used.)
3325
 
3331
 
3326
   One application which is notorious for "eating" colors is Netscape.  If
3332
   One application which is notorious for "eating" colors is Netscape.  If
3327
the problem occurs when Netscape is running, try (re)starting it with
3333
the problem occurs when Netscape is running, try (re)starting it with
3328
either the `-no-install' (to use the default colormap) or the `-install'
3334
either the `-no-install' (to use the default colormap) or the `-install'
3329
(to install a private colormap) option.
3335
(to install a private colormap) option.
3330
 
3336
 
3331
   You could also set the `colortype' of `X11()' to `"pseudo.cube"' rather
3337
   You could also set the `colortype' of `X11()' to `"pseudo.cube"' rather
3332
than the default `"pseudo"'.  See the help page for `X11()' for more
3338
than the default `"pseudo"'.  See the help page for `X11()' for more
3333
information.
3339
information.
3334
 
3340
 
3335
7.12 How do I convert factors to numeric?
3341
7.12 How do I convert factors to numeric?
3336
=========================================
3342
=========================================
3337
 
3343
 
3338
It may happen that when reading numeric data into R (usually, when reading
3344
It may happen that when reading numeric data into R (usually, when reading
3339
in a file), they come in as factors.  If `f' is such a factor object, you
3345
in a file), they come in as factors.  If `f' is such a factor object, you
3340
can use
3346
can use
3341
 
3347
 
3342
     as.numeric(as.character(f))
3348
     as.numeric(as.character(f))
3343
 
3349
 
3344
to get the numbers back.  More efficient, but harder to remember, is
3350
to get the numbers back.  More efficient, but harder to remember, is
3345
 
3351
 
3346
     as.numeric(levels(f))[as.integer(f)]
3352
     as.numeric(levels(f))[as.integer(f)]
3347
 
3353
 
3348
   In any case, do not call `as.numeric()' or their likes directly for the
3354
   In any case, do not call `as.numeric()' or their likes directly for the
3349
task at hand (as `as.numeric()' or `unclass()' give the internal codes).
3355
task at hand (as `as.numeric()' or `unclass()' give the internal codes).
3350
 
3356
 
3351
7.13 Are Trellis displays implemented in R?
3357
7.13 Are Trellis displays implemented in R?
3352
===========================================
3358
===========================================
3353
 
3359
 
3354
The recommended package *lattice* (which is based on another recommended
3360
The recommended package *lattice* (which is based on another recommended
3355
package, *grid*) provides graphical functionality that is compatible with
3361
package, *grid*) provides graphical functionality that is compatible with
3356
most Trellis commands.
3362
most Trellis commands.
3357
 
3363
 
3358
   You could also look at `coplot()' and `dotchart()' which might do at
3364
   You could also look at `coplot()' and `dotchart()' which might do at
3359
least some of what you want.  Note also that the R version of `pairs()' is
3365
least some of what you want.  Note also that the R version of `pairs()' is
3360
fairly general and provides most of the functionality of `splom()', and
3366
fairly general and provides most of the functionality of `splom()', and
3361
that R's default plot method has an argument `asp' allowing to specify (and
3367
that R's default plot method has an argument `asp' allowing to specify (and
3362
fix against device resizing) the aspect ratio of the plot.
3368
fix against device resizing) the aspect ratio of the plot.
3363
 
3369
 
3364
   (Because the word "Trellis" has been claimed as a trademark we do not
3370
   (Because the word "Trellis" has been claimed as a trademark we do not
3365
use it in R.  The name "lattice" has been chosen for the R equivalent.)
3371
use it in R.  The name "lattice" has been chosen for the R equivalent.)
3366
 
3372
 
3367
7.14 What are the enclosing and parent environments?
3373
7.14 What are the enclosing and parent environments?
3368
====================================================
3374
====================================================
3369
 
3375
 
3370
Inside a function you may want to access variables in two additional
3376
Inside a function you may want to access variables in two additional
3371
environments: the one that the function was defined in ("enclosing"), and
3377
environments: the one that the function was defined in ("enclosing"), and
3372
the one it was invoked in ("parent").
3378
the one it was invoked in ("parent").
3373
 
3379
 
3374
   If you create a function at the command line or load it in a package its
3380
   If you create a function at the command line or load it in a package its
3375
enclosing environment is the global workspace.  If you define a function
3381
enclosing environment is the global workspace.  If you define a function
3376
`f()' inside another function `g()' its enclosing environment is the
3382
`f()' inside another function `g()' its enclosing environment is the
3377
environment inside `g()'.  The enclosing environment for a function is
3383
environment inside `g()'.  The enclosing environment for a function is
3378
fixed when the function is created.  You can find out the enclosing
3384
fixed when the function is created.  You can find out the enclosing
3379
environment for a function `f()' using `environment(f)'.
3385
environment for a function `f()' using `environment(f)'.
3380
 
3386
 
3381
   The "parent" environment, on the other hand, is defined when you invoke
3387
   The "parent" environment, on the other hand, is defined when you invoke
3382
a function.  If you invoke `lm()' at the command line its parent
3388
a function.  If you invoke `lm()' at the command line its parent
3383
environment is the global workspace, if you invoke it inside a function
3389
environment is the global workspace, if you invoke it inside a function
3384
`f()' then its parent environment is the environment inside `f()'.  You can
3390
`f()' then its parent environment is the environment inside `f()'.  You can
3385
find out the parent environment for an invocation of a function by using
3391
find out the parent environment for an invocation of a function by using
3386
`parent.frame()' or `sys.frame(sys.parent())'.
3392
`parent.frame()' or `sys.frame(sys.parent())'.
3387
 
3393
 
3388
   So for most user-visible functions the enclosing environment will be the
3394
   So for most user-visible functions the enclosing environment will be the
3389
global workspace, since that is where most functions are defined.  The
3395
global workspace, since that is where most functions are defined.  The
3390
parent environment will be wherever the function happens to be called from.
3396
parent environment will be wherever the function happens to be called from.
3391
If a function `f()' is defined inside another function `g()' it will
3397
If a function `f()' is defined inside another function `g()' it will
3392
probably be used inside `g()' as well, so its parent environment and
3398
probably be used inside `g()' as well, so its parent environment and
3393
enclosing environment will probably be the same.
3399
enclosing environment will probably be the same.
3394
 
3400
 
3395
   Parent environments are important because things like model formulas
3401
   Parent environments are important because things like model formulas
3396
need to be evaluated in the environment the function was called from, since
3402
need to be evaluated in the environment the function was called from, since
3397
that's where all the variables will be available.  This relies on the
3403
that's where all the variables will be available.  This relies on the
3398
parent environment being potentially different with each invocation.
3404
parent environment being potentially different with each invocation.
3399
 
3405
 
3400
   Enclosing environments are important because a function can use
3406
   Enclosing environments are important because a function can use
3401
variables in the enclosing environment to share information with other
3407
variables in the enclosing environment to share information with other
3402
functions or with other invocations of itself (see the section on lexical
3408
functions or with other invocations of itself (see the section on lexical
3403
scoping).  This relies on the enclosing environment being the same each
3409
scoping).  This relies on the enclosing environment being the same each
3404
time the function is invoked.
3410
time the function is invoked.
3405
 
3411
 
3406
   Scoping _is_ hard.  Looking at examples helps.  It is particularly
3412
   Scoping _is_ hard.  Looking at examples helps.  It is particularly
3407
instructive to look at examples that work differently in R and S and try to
3413
instructive to look at examples that work differently in R and S and try to
3408
see why they differ.  One way to describe the scoping differences between R
3414
see why they differ.  One way to describe the scoping differences between R
3409
and S is to say that in S the enclosing environment is _always_ the global
3415
and S is to say that in S the enclosing environment is _always_ the global
3410
workspace, but in R the enclosing environment is wherever the function was
3416
workspace, but in R the enclosing environment is wherever the function was
3411
created.
3417
created.
3412
 
3418
 
3413
7.15 How can I substitute into a plot label?
3419
7.15 How can I substitute into a plot label?
3414
============================================
3420
============================================
3415
 
3421
 
3416
Often, it is desired to use the value of an R object in a plot label, e.g.,
3422
Often, it is desired to use the value of an R object in a plot label, e.g.,
3417
a title.  This is easily accomplished using `paste()' if the label is a
3423
a title.  This is easily accomplished using `paste()' if the label is a
3418
simple character string, but not always obvious in case the label is an
3424
simple character string, but not always obvious in case the label is an
3419
expression (for refined mathematical annotation).  In such a case, either
3425
expression (for refined mathematical annotation).  In such a case, either
3420
use `parse()' on your pasted character string or use `substitute()' on an
3426
use `parse()' on your pasted character string or use `substitute()' on an
3421
expression.  For example, if `ahat' is an estimator of your parameter a of
3427
expression.  For example, if `ahat' is an estimator of your parameter a of
3422
interest, use
3428
interest, use
3423
 
3429
 
3424
     title(substitute(hat(a) == ahat, list(ahat = ahat)))
3430
     title(substitute(hat(a) == ahat, list(ahat = ahat)))
3425
 
3431
 
3426
(note that it is `==' and not `=').  There are more worked examples in the
3432
(note that it is `==' and not `=').  There are more worked examples in the
3427
mailing list achives.
3433
mailing list achives.
3428
 
3434
 
3429
7.16 What are valid names?
3435
7.16 What are valid names?
3430
==========================
3436
==========================
3431
 
3437
 
3432
When creating data frames using `data.frame()' or `read.table()', R by
3438
When creating data frames using `data.frame()' or `read.table()', R by
3433
default ensures that the variable names are syntactically valid.  (The
3439
default ensures that the variable names are syntactically valid.  (The
3434
argument `check.names' to these functions controls whether variable names
3440
argument `check.names' to these functions controls whether variable names
3435
are checked and adjusted by `make.names()' if needed.)
3441
are checked and adjusted by `make.names()' if needed.)
3436
 
3442
 
3437
   To understand what names are "valid", one needs to take into account
3443
   To understand what names are "valid", one needs to take into account
3438
that the term "name" is used in several different (but related) ways in the
3444
that the term "name" is used in several different (but related) ways in the
3439
language:
3445
language:
3440
 
3446
 
3441
  1. A _syntactic name_ is a string the parser interprets as this type of
3447
  1. A _syntactic name_ is a string the parser interprets as this type of
3442
     expression.  It consists of letters, numbers, and the dot and (for
3448
     expression.  It consists of letters, numbers, and the dot and (for
3443
     version of R at least 1.9.0) underscore characters, and starts with
3449
     version of R at least 1.9.0) underscore characters, and starts with
3444
     either a letter or a dot not followed by a number.  Reserved words are
3450
     either a letter or a dot not followed by a number.  Reserved words are
3445
     not syntactic names.
3451
     not syntactic names.
3446
 
3452
 
3447
  2. An _object name_ is a string associated with an object that is
3453
  2. An _object name_ is a string associated with an object that is
3448
     assigned in an expression either by having the object name on the left
3454
     assigned in an expression either by having the object name on the left
3449
     of an assignment operation or as an argument to the `assign()'
3455
     of an assignment operation or as an argument to the `assign()'
3450
     function.  It is usually a syntactic name as well, but can be any
3456
     function.  It is usually a syntactic name as well, but can be any
3451
     non-empty string if it is quoted (and it is always quoted in the call
3457
     non-empty string if it is quoted (and it is always quoted in the call
3452
     to `assign()').
3458
     to `assign()').
3453
 
3459
 
3454
  3. An _argument name_ is what appears to the left of the equals sign when
3460
  3. An _argument name_ is what appears to the left of the equals sign when
3455
     supplying an argument in a function call (for example, `f(trim=.5)').
3461
     supplying an argument in a function call (for example, `f(trim=.5)').
3456
     Argument names are also usually syntactic names, but again can be
3462
     Argument names are also usually syntactic names, but again can be
3457
     anything if they are quoted.
3463
     anything if they are quoted.
3458
 
3464
 
3459
  4. An _element name_ is a string that identifies a piece of an object (a
3465
  4. An _element name_ is a string that identifies a piece of an object (a
3460
     component of a list, for example.)  When it is used on the right of
3466
     component of a list, for example.)  When it is used on the right of
3461
     the `$' operator, it must be a syntactic name, or quoted.  Otherwise,
3467
     the `$' operator, it must be a syntactic name, or quoted.  Otherwise,
3462
     element names can be any strings.  (When an object is used as a
3468
     element names can be any strings.  (When an object is used as a
3463
     database, as in a call to `eval()' or `attach()', the element names
3469
     database, as in a call to `eval()' or `attach()', the element names
3464
     become object names.)
3470
     become object names.)
3465
 
3471
 
3466
  5. Finally, a _file name_ is a string identifying a file in the operating
3472
  5. Finally, a _file name_ is a string identifying a file in the operating
3467
     system for reading, writing, etc.  It really has nothing much to do
3473
     system for reading, writing, etc.  It really has nothing much to do
3468
     with names in the language, but it is traditional to call these
3474
     with names in the language, but it is traditional to call these
3469
     strings file "names".
3475
     strings file "names".
3470
 
3476
 
3471
7.17 Are GAMs implemented in R?
3477
7.17 Are GAMs implemented in R?
3472
===============================
3478
===============================
3473
 
3479
 
3474
There is a `gam()' function for Generalized Additive Models in package
3480
There is a `gam()' function for Generalized Additive Models in package
3475
*mgcv*, but it is not an exact clone of what is described in the White Book
3481
*mgcv*, but it is not an exact clone of what is described in the White Book
3476
(no `lo()' for example).  Package *gss* can fit spline-based GAMs too.  And
3482
(no `lo()' for example).  Package *gss* can fit spline-based GAMs too.  And
3477
if you can accept regression splines you can use `glm()'.  For gaussian
3483
if you can accept regression splines you can use `glm()'.  For gaussian
3478
GAMs you can use `bruto()' from package *mda*.
3484
GAMs you can use `bruto()' from package *mda*.
3479
 
3485
 
3480
7.18 Why is the output not printed when I source() a file?
3486
7.18 Why is the output not printed when I source() a file?
3481
==========================================================
3487
==========================================================
3482
 
3488
 
3483
Most R commands do not generate any output. The command
3489
Most R commands do not generate any output. The command
3484
 
3490
 
3485
     1+1
3491
     1+1
3486
 
3492
 
3487
computes the value 2 and returns it; the command
3493
computes the value 2 and returns it; the command
3488
 
3494
 
3489
     summary(glm(y~x+z, family=binomial))
3495
     summary(glm(y~x+z, family=binomial))
3490
 
3496
 
3491
fits a logistic regression model, computes some summary information and
3497
fits a logistic regression model, computes some summary information and
3492
returns an object of class `"summary.glm"' (*note How should I write
3498
returns an object of class `"summary.glm"' (*note How should I write
3493
summary methods?::).
3499
summary methods?::).
3494
 
3500
 
3495
   If you type `1+1' or `summary(glm(y~x+z, family=binomial))' at the
3501
   If you type `1+1' or `summary(glm(y~x+z, family=binomial))' at the
3496
command line the returned value is automatically printed (unless it is
3502
command line the returned value is automatically printed (unless it is
3497
`invisible()'), but in other circumstances, such as in a `source()'d file
3503
`invisible()'), but in other circumstances, such as in a `source()'d file
3498
or inside a function it isn't printed unless you specifically print it.
3504
or inside a function it isn't printed unless you specifically print it.
3499
 
3505
 
3500
   To print the value use
3506
   To print the value use
3501
 
3507
 
3502
     print(1+1)
3508
     print(1+1)
3503
 
3509
 
3504
or
3510
or
3505
 
3511
 
3506
     print(summary(glm(y~x+z, family=binomial)))
3512
     print(summary(glm(y~x+z, family=binomial)))
3507
 
3513
 
3508
instead, or use `source(FILE, echo=TRUE)'.
3514
instead, or use `source(FILE, echo=TRUE)'.
3509
 
3515
 
3510
7.19 Why does outer() behave strangely with my function?
3516
7.19 Why does outer() behave strangely with my function?
3511
========================================================
3517
========================================================
3512
 
3518
 
3513
As the help for `outer()' indicates, it does not work on arbitrary
3519
As the help for `outer()' indicates, it does not work on arbitrary
3514
functions the way the `apply()' family does.  It requires functions that
3520
functions the way the `apply()' family does.  It requires functions that
3515
are vectorized to work elementwise on arrays.  As you can see by looking at
3521
are vectorized to work elementwise on arrays.  As you can see by looking at
3516
the code, `outer(x, y, FUN)' creates two large vectors containing every
3522
the code, `outer(x, y, FUN)' creates two large vectors containing every
3517
possible combination of elements of `x' and `y' and then passes this to
3523
possible combination of elements of `x' and `y' and then passes this to
3518
`FUN' all at once.  Your function probably cannot handle two large vectors
3524
`FUN' all at once.  Your function probably cannot handle two large vectors
3519
as parameters.
3525
as parameters.
3520
 
3526
 
3521
   If you have a function that cannot handle two vectors but can handle two
3527
   If you have a function that cannot handle two vectors but can handle two
3522
scalars, then you can still use `outer()' but you will need to wrap your
3528
scalars, then you can still use `outer()' but you will need to wrap your
3523
function up first, to simulate vectorized behavior.  Suppose your function
3529
function up first, to simulate vectorized behavior.  Suppose your function
3524
is
3530
is
3525
 
3531
 
3526
     foo <- function(x, y, happy) {
3532
     foo <- function(x, y, happy) {
3527
       stopifnot(length(x) == 1, length(y) == 1) # scalars only!
3533
       stopifnot(length(x) == 1, length(y) == 1) # scalars only!
3528
       (x + y) * happy
3534
       (x + y) * happy
3529
     }
3535
     }
3530
 
3536
 
3531
If you define the general function
3537
If you define the general function
3532
 
3538
 
3533
     wrapper <- function(x, y, my.fun, ...) {
3539
     wrapper <- function(x, y, my.fun, ...) {
3534
       sapply(seq(along = x), FUN = function(i) my.fun(x[i], y[i], ...))
3540
       sapply(seq(along = x), FUN = function(i) my.fun(x[i], y[i], ...))
3535
     }
3541
     }
3536
 
3542
 
3537
then you can use `outer()' by writing, e.g.,
3543
then you can use `outer()' by writing, e.g.,
3538
 
3544
 
3539
     outer(1:4, 1:2, FUN = wrapper, my.fun = foo, happy = 10)
3545
     outer(1:4, 1:2, FUN = wrapper, my.fun = foo, happy = 10)
3540
 
3546
 
3541
7.20 Why does the output from anova() depend on the order of factors in the model?
3547
7.20 Why does the output from anova() depend on the order of factors in the model?
3542
==================================================================================
3548
==================================================================================
3543
 
3549
 
3544
In a model such as `~A+B+A:B', R will report the difference in sums of
3550
In a model such as `~A+B+A:B', R will report the difference in sums of
3545
squares between the models `~1', `~A', `~A+B' and `~A+B+A:B'.  If the model
3551
squares between the models `~1', `~A', `~A+B' and `~A+B+A:B'.  If the model
3546
were `~B+A+A:B', R would report differences between `~1', `~B', `~A+B', and
3552
were `~B+A+A:B', R would report differences between `~1', `~B', `~A+B', and
3547
`~A+B+A:B' . In the first case the sum of squares for `A' is comparing `~1'
3553
`~A+B+A:B' . In the first case the sum of squares for `A' is comparing `~1'
3548
and `~A', in the second case it is comparing `~B' and `~B+A'.  In a
3554
and `~A', in the second case it is comparing `~B' and `~B+A'.  In a
3549
non-orthogonal design (i.e., most unbalanced designs) these comparisons are
3555
non-orthogonal design (i.e., most unbalanced designs) these comparisons are
3550
(conceptually and numerically) different.
3556
(conceptually and numerically) different.
3551
 
3557
 
3552
   Some packages report instead the sums of squares based on comparing the
3558
   Some packages report instead the sums of squares based on comparing the
3553
full model to the models with each factor removed one at a time (the famous
3559
full model to the models with each factor removed one at a time (the famous
3554
`Type III sums of squares' from SAS, for example).  These do not depend on
3560
`Type III sums of squares' from SAS, for example).  These do not depend on
3555
the order of factors in the model.  The question of which set of sums of
3561
the order of factors in the model.  The question of which set of sums of
3556
squares is the Right Thing provokes low-level holy wars on R-help from time
3562
squares is the Right Thing provokes low-level holy wars on R-help from time
3557
to time.
3563
to time.
3558
 
3564
 
3559
   There is no need to be agitated about the particular sums of squares
3565
   There is no need to be agitated about the particular sums of squares
3560
that R reports.  You can compute your favorite sums of squares quite
3566
that R reports.  You can compute your favorite sums of squares quite
3561
easily.  Any two models can be compared with `anova(MODEL1, MODEL2)', and
3567
easily.  Any two models can be compared with `anova(MODEL1, MODEL2)', and
3562
`drop1(MODEL1)' will show the sums of squares resulting from dropping
3568
`drop1(MODEL1)' will show the sums of squares resulting from dropping
3563
single terms.
3569
single terms.
3564
 
3570
 
3565
7.21 How do I produce PNG graphics in batch mode?
3571
7.21 How do I produce PNG graphics in batch mode?
3566
=================================================
3572
=================================================
3567
 
3573
 
3568
Under Unix, the `png()' device uses the X11 driver, which is a problem in
3574
Under Unix, the `png()' device uses the X11 driver, which is a problem in
3569
batch mode or for remote operation.  If you have Ghostscript you can use
3575
batch mode or for remote operation.  If you have Ghostscript you can use
3570
`bitmap()', which produces a PostScript file then converts it to any bitmap
3576
`bitmap()', which produces a PostScript file then converts it to any bitmap
3571
format supported by ghostscript.  On some installations this produces ugly
3577
format supported by ghostscript.  On some installations this produces ugly
3572
output, on others it is perfectly satisfactory.  In theory one could also
3578
output, on others it is perfectly satisfactory.  In theory one could also
3573
use Xvfb, which provides an X server with no display.
3579
use Xvfb, which provides an X server with no display.
3574
 
3580
 
3575
7.22 How can I get command line editing to work?
3581
7.22 How can I get command line editing to work?
3576
================================================
3582
================================================
3577
 
3583
 
3578
The Unix command-line interface to R can only provide the inbuilt command
3584
The Unix command-line interface to R can only provide the inbuilt command
3579
line editor which allows recall, editing and re-submission of prior
3585
line editor which allows recall, editing and re-submission of prior
3580
commands provided that the GNU readline library is available at the time R
3586
commands provided that the GNU readline library is available at the time R
3581
is configured for compilation.  Note that the `development' version of
3587
is configured for compilation.  Note that the `development' version of
3582
readline including the appropriate headers is needed: users of Linux binary
3588
readline including the appropriate headers is needed: users of Linux binary
3583
distributions will need to install packages such as `libreadline-dev'
3589
distributions will need to install packages such as `libreadline-dev'
3584
(Debian) or `readline-devel' (Red Hat).
3590
(Debian) or `readline-devel' (Red Hat).
3585
 
3591
 
3586
7.23 How can I turn a string into a variable?
3592
7.23 How can I turn a string into a variable?
3587
=============================================
3593
=============================================
3588
 
3594
 
3589
If you have
3595
If you have
3590
 
3596
 
3591
     varname <- c("a", "b", "d")
3597
     varname <- c("a", "b", "d")
3592
 
3598
 
3593
you can do
3599
you can do
3594
 
3600
 
3595
     get(varname[1]) + 2
3601
     get(varname[1]) + 2
3596
 
3602
 
3597
for
3603
for
3598
 
3604
 
3599
     a + 2
3605
     a + 2
3600
 
3606
 
3601
or
3607
or
3602
 
3608
 
3603
     assign(varname[1], 2 + 2)
3609
     assign(varname[1], 2 + 2)
3604
 
3610
 
3605
for
3611
for
3606
 
3612
 
3607
     a <- 2 + 2
3613
     a <- 2 + 2
3608
 
3614
 
3609
or
3615
or
3610
 
3616
 
3611
     eval(substitute(lm(y ~ x + variable),
3617
     eval(substitute(lm(y ~ x + variable),
3612
                     list(variable = as.name(varname[1]))
3618
                     list(variable = as.name(varname[1]))
3613
 
3619
 
3614
for
3620
for
3615
 
3621
 
3616
     lm(y ~ x + a)
3622
     lm(y ~ x + a)
3617
 
3623
 
3618
   At least in the first two cases it is often easier to just use a list,
3624
   At least in the first two cases it is often easier to just use a list,
3619
and then you can easily index it by name
3625
and then you can easily index it by name
3620
 
3626
 
3621
     vars <- list(a = 1:10, b = rnorm(100), d = LETTERS)
3627
     vars <- list(a = 1:10, b = rnorm(100), d = LETTERS)
3622
     vars[["a"]]
3628
     vars[["a"]]
3623
 
3629
 
3624
without any of this messing about.
3630
without any of this messing about.
3625
 
3631
 
3626
7.24 Why do lattice/trellis graphics not work?
3632
7.24 Why do lattice/trellis graphics not work?
3627
==============================================
3633
==============================================
3628
 
3634
 
3629
The most likely reason is that you forgot to tell R to display the graph.
3635
The most likely reason is that you forgot to tell R to display the graph.
3630
Lattice functions such as `xyplot()' create a graph object, but do not
3636
Lattice functions such as `xyplot()' create a graph object, but do not
3631
display it (the same is true of Trellis graphics in S-PLUS).  The `print()'
3637
display it (the same is true of Trellis graphics in S-PLUS).  The `print()'
3632
method for the graph object produces the actual display.  When you use
3638
method for the graph object produces the actual display.  When you use
3633
these functions interactively at the command line, the result is
3639
these functions interactively at the command line, the result is
3634
automatically printed, but in `source()' or inside your own functions you
3640
automatically printed, but in `source()' or inside your own functions you
3635
will need an explicit `print()' statement.
3641
will need an explicit `print()' statement.
3636
 
3642
 
3637
7.25 How can I sort the rows of a data frame?
3643
7.25 How can I sort the rows of a data frame?
3638
=============================================
3644
=============================================
3639
 
3645
 
3640
To sort the rows within a data frame, with respect to the values in one or
3646
To sort the rows within a data frame, with respect to the values in one or
3641
more of the columns, simply use `order()'.
3647
more of the columns, simply use `order()'.
3642
 
3648
 
3643
8 R Programming
3649
8 R Programming
3644
***************
3650
***************
3645
 
3651
 
3646
8.1 How should I write summary methods?
3652
8.1 How should I write summary methods?
3647
=======================================
3653
=======================================
3648
 
3654
 
3649
Suppose you want to provide a summary method for class `"foo"'.  Then
3655
Suppose you want to provide a summary method for class `"foo"'.  Then
3650
`summary.foo()' should not print anything, but return an object of class
3656
`summary.foo()' should not print anything, but return an object of class
3651
`"summary.foo"', _and_ you should write a method `print.summary.foo()'
3657
`"summary.foo"', _and_ you should write a method `print.summary.foo()'
3652
which nicely prints the summary information and invisibly returns its
3658
which nicely prints the summary information and invisibly returns its
3653
object.  This approach is preferred over having `summary.foo()' print
3659
object.  This approach is preferred over having `summary.foo()' print
3654
summary information and return something useful, as sometimes you need to
3660
summary information and return something useful, as sometimes you need to
3655
grab something computed by `summary()' inside a function or similar.  In
3661
grab something computed by `summary()' inside a function or similar.  In
3656
such cases you don't want anything printed.
3662
such cases you don't want anything printed.
3657
 
3663
 
3658
8.2 How can I debug dynamically loaded code?
3664
8.2 How can I debug dynamically loaded code?
3659
============================================
3665
============================================
3660
 
3666
 
3661
Roughly speaking, you need to start R inside the debugger, load the code,
3667
Roughly speaking, you need to start R inside the debugger, load the code,
3662
send an interrupt, and then set the required breakpoints.
3668
send an interrupt, and then set the required breakpoints.
3663
 
3669
 
3664
   See section "Finding entry points in dynamically loaded code" in
3670
   See section "Finding entry points in dynamically loaded code" in
3665
`Writing R Extensions'.  This manual is included in the R distribution,
3671
`Writing R Extensions'.  This manual is included in the R distribution,
3666
*note What documentation exists for R?::.
3672
*note What documentation exists for R?::.
3667
 
3673
 
3668
8.3 How can I inspect R objects when debugging?
3674
8.3 How can I inspect R objects when debugging?
3669
===============================================
3675
===============================================
3670
 
3676
 
3671
The most convenient way is to call `R_PV' from the symbolic debugger.
3677
The most convenient way is to call `R_PV' from the symbolic debugger.
3672
 
3678
 
3673
   See section "Inspecting R objects when debugging" in `Writing R
3679
   See section "Inspecting R objects when debugging" in `Writing R
3674
Extensions'.
3680
Extensions'.
3675
 
3681
 
3676
8.4 How can I change compilation flags?
3682
8.4 How can I change compilation flags?
3677
=======================================
3683
=======================================
3678
 
3684
 
3679
Suppose you have C code file for dynloading into R, but you want to use `R
3685
Suppose you have C code file for dynloading into R, but you want to use `R
3680
CMD SHLIB' with compilation flags other than the default ones (which were
3686
CMD SHLIB' with compilation flags other than the default ones (which were
3681
determined when R was built).  You could change the file
3687
determined when R was built).  You could change the file
3682
``R_HOME'/etc/Makeconf' to reflect your preferences.  If you are a Bourne
3688
``R_HOME'/etc/Makeconf' to reflect your preferences.  If you are a Bourne
3683
shell user, you can also pass the desired flags to Make (which is used for
3689
shell user, you can also pass the desired flags to Make (which is used for
3684
controlling compilation) via the Make variable `MAKEFLAGS', as in
3690
controlling compilation) via the Make variable `MAKEFLAGS', as in
3685
 
3691
 
3686
     MAKEFLAGS="CFLAGS=-O3" R CMD SHLIB *.c
3692
     MAKEFLAGS="CFLAGS=-O3" R CMD SHLIB *.c
3687
 
3693
 
3688
9 R Bugs
3694
9 R Bugs
3689
********
3695
********
3690
 
3696
 
3691
9.1 What is a bug?
3697
9.1 What is a bug?
3692
==================
3698
==================
3693
 
3699
 
3694
If R executes an illegal instruction, or dies with an operating system
3700
If R executes an illegal instruction, or dies with an operating system
3695
error message that indicates a problem in the program (as opposed to
3701
error message that indicates a problem in the program (as opposed to
3696
something like "disk full"), then it is certainly a bug.  If you call
3702
something like "disk full"), then it is certainly a bug.  If you call
3697
`.C()', `.Fortran()', `.External()' or `.Call()' (or `.Internal()')
3703
`.C()', `.Fortran()', `.External()' or `.Call()' (or `.Internal()')
3698
yourself (or in a function you wrote), you can always crash R by using
3704
yourself (or in a function you wrote), you can always crash R by using
3699
wrong argument types (modes).  This is not a bug.
3705
wrong argument types (modes).  This is not a bug.
3700
 
3706
 
3701
   Taking forever to complete a command can be a bug, but you must make
3707
   Taking forever to complete a command can be a bug, but you must make
3702
certain that it was really R's fault.  Some commands simply take a long
3708
certain that it was really R's fault.  Some commands simply take a long
3703
time.  If the input was such that you _know_ it should have been processed
3709
time.  If the input was such that you _know_ it should have been processed
3704
quickly, report a bug.  If you don't know whether the command should take a
3710
quickly, report a bug.  If you don't know whether the command should take a
3705
long time, find out by looking in the manual or by asking for assistance.
3711
long time, find out by looking in the manual or by asking for assistance.
3706
 
3712
 
3707
   If a command you are familiar with causes an R error message in a case
3713
   If a command you are familiar with causes an R error message in a case
3708
where its usual definition ought to be reasonable, it is probably a bug.
3714
where its usual definition ought to be reasonable, it is probably a bug.
3709
If a command does the wrong thing, that is a bug.  But be sure you know for
3715
If a command does the wrong thing, that is a bug.  But be sure you know for
3710
certain what it ought to have done.  If you aren't familiar with the
3716
certain what it ought to have done.  If you aren't familiar with the
3711
command, or don't know for certain how the command is supposed to work,
3717
command, or don't know for certain how the command is supposed to work,
3712
then it might actually be working right.  Rather than jumping to
3718
then it might actually be working right.  Rather than jumping to
3713
conclusions, show the problem to someone who knows for certain.
3719
conclusions, show the problem to someone who knows for certain.
3714
 
3720
 
3715
   Finally, a command's intended definition may not be best for statistical
3721
   Finally, a command's intended definition may not be best for statistical
3716
analysis.  This is a very important sort of problem, but it is also a
3722
analysis.  This is a very important sort of problem, but it is also a
3717
matter of judgment.  Also, it is easy to come to such a conclusion out of
3723
matter of judgment.  Also, it is easy to come to such a conclusion out of
3718
ignorance of some of the existing features.  It is probably best not to
3724
ignorance of some of the existing features.  It is probably best not to
3719
complain about such a problem until you have checked the documentation in
3725
complain about such a problem until you have checked the documentation in
3720
the usual ways, feel confident that you understand it, and know for certain
3726
the usual ways, feel confident that you understand it, and know for certain
3721
that what you want is not available.  If you are not sure what the command
3727
that what you want is not available.  If you are not sure what the command
3722
is supposed to do after a careful reading of the manual this indicates a
3728
is supposed to do after a careful reading of the manual this indicates a
3723
bug in the manual.  The manual's job is to make everything clear.  It is
3729
bug in the manual.  The manual's job is to make everything clear.  It is
3724
just as important to report documentation bugs as program bugs.  However,
3730
just as important to report documentation bugs as program bugs.  However,
3725
we know that the introductory documentation is seriously inadequate, so you
3731
we know that the introductory documentation is seriously inadequate, so you
3726
don't need to report this.
3732
don't need to report this.
3727
 
3733
 
3728
   If the online argument list of a function disagrees with the manual, one
3734
   If the online argument list of a function disagrees with the manual, one
3729
of them must be wrong, so report the bug.
3735
of them must be wrong, so report the bug.
3730
 
3736
 
3731
9.2 How to report a bug
3737
9.2 How to report a bug
3732
=======================
3738
=======================
3733
 
3739
 
3734
When you decide that there is a bug, it is important to report it and to
3740
When you decide that there is a bug, it is important to report it and to
3735
report it in a way which is useful.  What is most useful is an exact
3741
report it in a way which is useful.  What is most useful is an exact
3736
description of what commands you type, starting with the shell command to
3742
description of what commands you type, starting with the shell command to
3737
run R, until the problem happens.  Always include the version of R,
3743
run R, until the problem happens.  Always include the version of R,
3738
machine, and operating system that you are using; type `version' in R to
3744
machine, and operating system that you are using; type `version' in R to
3739
print this.
3745
print this.
3740
 
3746
 
3741
   The most important principle in reporting a bug is to report _facts_,
3747
   The most important principle in reporting a bug is to report _facts_,
3742
not hypotheses or categorizations.  It is always easier to report the
3748
not hypotheses or categorizations.  It is always easier to report the
3743
facts, but people seem to prefer to strain to posit explanations and report
3749
facts, but people seem to prefer to strain to posit explanations and report
3744
them instead.  If the explanations are based on guesses about how R is
3750
them instead.  If the explanations are based on guesses about how R is
3745
implemented, they will be useless; others will have to try to figure out
3751
implemented, they will be useless; others will have to try to figure out
3746
what the facts must have been to lead to such speculations.  Sometimes this
3752
what the facts must have been to lead to such speculations.  Sometimes this
3747
is impossible.  But in any case, it is unnecessary work for the ones trying
3753
is impossible.  But in any case, it is unnecessary work for the ones trying
3748
to fix the problem.
3754
to fix the problem.
3749
 
3755
 
3750
   For example, suppose that on a data set which you know to be quite large
3756
   For example, suppose that on a data set which you know to be quite large
3751
the command
3757
the command
3752
 
3758
 
3753
     R> data.frame(x, y, z, monday, tuesday)
3759
     R> data.frame(x, y, z, monday, tuesday)
3754
 
3760
 
3755
never returns.  Do not report that `data.frame()' fails for large data
3761
never returns.  Do not report that `data.frame()' fails for large data
3756
sets.  Perhaps it fails when a variable name is a day of the week.  If this
3762
sets.  Perhaps it fails when a variable name is a day of the week.  If this
3757
is so then when others got your report they would try out the
3763
is so then when others got your report they would try out the
3758
`data.frame()' command on a large data set, probably with no day of the
3764
`data.frame()' command on a large data set, probably with no day of the
3759
week variable name, and not see any problem.  There is no way in the world
3765
week variable name, and not see any problem.  There is no way in the world
3760
that others could guess that they should try a day of the week variable
3766
that others could guess that they should try a day of the week variable
3761
name.
3767
name.
3762
 
3768
 
3763
   Or perhaps the command fails because the last command you used was a
3769
   Or perhaps the command fails because the last command you used was a
3764
method for `"["()' that had a bug causing R's internal data structures to
3770
method for `"["()' that had a bug causing R's internal data structures to
3765
be corrupted and making the `data.frame()' command fail from then on.  This
3771
be corrupted and making the `data.frame()' command fail from then on.  This
3766
is why others need to know what other commands you have typed (or read from
3772
is why others need to know what other commands you have typed (or read from
3767
your startup file).
3773
your startup file).
3768
 
3774
 
3769
   It is very useful to try and find simple examples that produce
3775
   It is very useful to try and find simple examples that produce
3770
apparently the same bug, and somewhat useful to find simple examples that
3776
apparently the same bug, and somewhat useful to find simple examples that
3771
might be expected to produce the bug but actually do not.  If you want to
3777
might be expected to produce the bug but actually do not.  If you want to
3772
debug the problem and find exactly what caused it, that is wonderful.  You
3778
debug the problem and find exactly what caused it, that is wonderful.  You
3773
should still report the facts as well as any explanations or solutions.
3779
should still report the facts as well as any explanations or solutions.
3774
Please include an example that reproduces the problem, preferably the
3780
Please include an example that reproduces the problem, preferably the
3775
simplest one you have found.
3781
simplest one you have found.
3776
 
3782
 
3777
   Invoking R with the `--vanilla' option may help in isolating a bug.
3783
   Invoking R with the `--vanilla' option may help in isolating a bug.
3778
This ensures that the site profile and saved data files are not read.
3784
This ensures that the site profile and saved data files are not read.
3779
 
3785
 
3780
   On Unix systems a bug report can be generated using the function
3786
   On Unix systems a bug report can be generated using the function
3781
`bug.report()'.  This automatically includes the version information and
3787
`bug.report()'.  This automatically includes the version information and
3782
sends the bug to the correct address.  Alternatively the bug report can be
3788
sends the bug to the correct address.  Alternatively the bug report can be
3783
emailed to <R-bugs@R-project.org> or submitted to the Web page at
3789
emailed to <R-bugs@R-project.org> or submitted to the Web page at
3784
`http://bugs.R-project.org/'.
3790
`http://bugs.R-project.org/'.
3785
 
3791
 
3786
   Bug reports on contributed packages should perhaps be sent to the
3792
   Bug reports on contributed packages should perhaps be sent to the
3787
package maintainer rather than to R-bugs.
3793
package maintainer rather than to R-bugs.
3788
 
3794
 
3789
10 Acknowledgments
3795
10 Acknowledgments
3790
******************
3796
******************
3791
 
3797
 
3792
Of course, many many thanks to Robert and Ross for the R system, and to the
3798
Of course, many many thanks to Robert and Ross for the R system, and to the
3793
package writers and porters for adding to it.
3799
package writers and porters for adding to it.
3794
 
3800
 
3795
   Special thanks go to Doug Bates, Peter Dalgaard, Paul Gilbert, Stefano
3801
   Special thanks go to Doug Bates, Peter Dalgaard, Paul Gilbert, Stefano
3796
Iacus, Fritz Leisch, Jim Lindsey, Thomas Lumley, Martin Maechler, Brian D.
3802
Iacus, Fritz Leisch, Jim Lindsey, Thomas Lumley, Martin Maechler, Brian D.
3797
Ripley, Anthony Rossini, and Andreas Weingessel for their comments which
3803
Ripley, Anthony Rossini, and Andreas Weingessel for their comments which
3798
helped me improve this FAQ.
3804
helped me improve this FAQ.
3799
 
3805
 
3800
   More to some soon ...
3806
   More to some soon ...
3801
 
3807