The R Project SVN R

Rev

Details | Last modification | View Log | RSS feed

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