The R Project SVN R

Rev

Rev 28302 | Details | Compare with Previous | 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
28362 murdoch 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
 
28362 murdoch 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
 
28362 murdoch 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
 
28302 murdoch 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
 
18075 hornik 1718
*evd*
1719
     Functions for extreme value distributions.  Extends simulation,
1720
     distribution, quantile and density functions to univariate, bivariate
1721
     and (for simulation) multivariate parametric extreme value
1722
     distributions, and provides fitting functions which calculate maximum
1723
     likelihood estimates for univariate and bivariate models.
1724
 
25457 hornik 1725
*exactLoglinTest*
1726
     Monte Carlo exact tests for log-linear models.
1727
 
12151 hornik 1728
*exactRankTests*
1729
     Computes exact p-values and quantiles using an implementation of the
1730
     Streitberg/Roehmel shift algorithm.
1731
 
15398 hornik 1732
*fastICA*
15371 hornik 1733
     Implementation of FastICA algorithm to perform Independent Component
1734
     Analysis (ICA) and Projection Pursuit.
1735
 
27767 hornik 1736
*fda*
1737
     Functional Data Analysis: analysis of data where the basic observation
1738
     is a function of some sort.
1739
 
8649 hornik 1740
*fdim*
1741
     Functions for calculating fractal dimension.
1742
 
15168 pd 1743
*fields*
1744
     A collection of programs for curve and function fitting with an
1745
     emphasis on spatial data.  The major methods implemented include cubic
1746
     and thin plate splines, universal Kriging and Kriging for large data
1747
     sets.  The main feature is that any covariance function implemented in
1748
     R can be used for spatial prediction.
1749
 
25181 hornik 1750
*flexmix*
1751
     Flexible Mixture Modeling: a general framework for finite mixtures of
1752
     regression models using the EM algorithm.
1753
 
11810 hornik 1754
*foreign*
11828 hornik 1755
     Functions for reading and writing data stored by statistical software
21379 hornik 1756
     like Minitab, SAS, SPSS, Stata, etc.  _Recommended_.
11810 hornik 1757
 
27697 hornik 1758
*fork*
1759
     Functions for handling multiple processes: simple wrappers around the
1760
     Unix process management API calls.
1761
 
25061 hornik 1762
*forward*
1763
     Forward search approach to robust analysis in linear and generalized
1764
     linear regression models.
1765
 
24976 hornik 1766
*fpc*
1767
     Fixed point clusters, clusterwise regression and discriminant plots.
1768
 
3930 hornik 1769
*fracdiff*
1770
     Maximum likelihood estimation of the parameters of a fractionally
1771
     differenced ARIMA(p,d,q) model (Haslett and Raftery, Applied
1772
     Statistics, 1989).
1773
 
26255 hornik 1774
*ftnonpar*
1775
     Features and strings for nonparametric regression.
1776
 
17030 hornik 1777
*g.data*
1778
     Create and maintain delayed-data packages (DDP's).
1779
 
10340 hornik 1780
*gafit*
1781
     Genetic algorithm for curve fitting.
1782
 
27998 hornik 1783
*gap*
1784
     Genetic analysis package for both population and family data.
1785
 
23268 hornik 1786
*gbm*
1787
     Generalized Boosted Regression Models: implements extensions to Freund
1788
     and Schapire's AdaBoost algorithm and J. Friedman's gradient boosting
1789
     machine.  Includes regression methods for least squares, absolute loss,
1790
     logistic, Poisson, Cox proportional hazards partial likelihood, and
1791
     AdaBoost exponential loss.
1792
 
27998 hornik 1793
*gclus*
1794
     Clustering Graphics.  Orders panels in scatterplot matrices and
1795
     parallel coordinate displays by some merit index.
1796
 
3930 hornik 1797
*gee*
1798
     An implementation of the Liang/Zeger generalized estimating equation
1799
     approach to GLMs for dependent data.
1800
 
21318 hornik 1801
*geepack*
1802
     Generalized estimating equations solver for parameters in mean, scale,
1803
     and correlation structures, through mean link, scale link, and
1804
     correlation link.  Can also handle clustered categorical responses.
1805
 
21879 hornik 1806
*genetics*
1807
     Classes and methods for handling genetic data.  Includes classes to
1808
     represent genotypes and haplotypes at single markers up to multiple
1809
     markers on multiple chromosomes, and functions for allele frequencies,
1810
     flagging homo/heterozygotes, flagging carriers of certain alleles,
1811
     computing disequlibrium, testing Hardy-Weinberg equilibrium, ...
1812
 
14374 hornik 1813
*geoR*
1814
     Functions to perform geostatistical data analysis including model-based
1815
     methods.
1816
 
18220 hornik 1817
*geoRglm*
1818
     Functions for inference in generalised linear spatial models.
1819
 
26199 hornik 1820
*ggm*
1821
     Functions for defining directed acyclic graphs and undirected graphs,
1822
     finding induced graphs and fitting Gaussian Markov models.
1823
 
11154 hornik 1824
*gld*
1825
     Basic functions for the generalised (Tukey) lambda distribution.
1826
 
27279 hornik 1827
*gllm*
1828
     Routines for log-linear models of incomplete contingency tables,
1829
     including some latent class models via EM and Fisher scoring
1830
     approaches.
1831
 
22723 hornik 1832
*glmmML*
1833
     A Maximum Likelihood approach to generalized linear models with random
1834
     intercept.
1835
 
22628 hornik 1836
*gpclib*
1837
     General polygon clipping routines for R based on Alan Murta's C
1838
     library.
1839
 
22274 hornik 1840
*grasper*
1841
     Generalized Regression Analysis and Spatial Predictions for R.
1842
 
14374 hornik 1843
*gregmisc*
1844
     Miscellaneous functions written/maintained by Gregory R. Warnes.
1845
 
26562 hornik 1846
*gridBase*
1847
     Integration of base and grid graphics.
17467 hornik 1848
 
5101 hornik 1849
*gss*
1850
     A comprehensive package for structural multivariate function estimation
1851
     using smoothing splines.
1852
 
23020 hornik 1853
*gstat*
1854
     multivariable geostatistical modelling, prediction and simulation.
1855
     Includes code for variogram modelling; simple, ordinary and universal
1856
     point or block (co)kriging, sequential Gaussian or indicator
1857
     (co)simulation, and map plotting functions.
1858
 
20038 hornik 1859
*gtkDevice*
1860
     GTK graphics device driver that may be used independently of the
1861
     R-GNOME interface and can be used to create R devices as embedded
1862
     components in a GUI using a Gtk drawing area widget, e.g., using RGtk.
1863
 
28155 hornik 1864
*hapassoc*
1865
     Likelihood inference of trait associations with SNP haplotypes and
1866
     other attributes using the EM Algorithm.
1867
 
21318 hornik 1868
*haplo.score*
1869
     Score tests for association of traits with haplotypes when linkage
1870
     phase is ambiguous.
1871
 
17705 hornik 1872
*hdf5*
1873
     Interface to the NCSA HDF5 library.
1874
 
28362 murdoch 1875
*hett*
1876
     Functions for the fitting and summarizing of heteroscedastic
1877
     t-regression.
1878
 
23395 hornik 1879
*hier.part*
1880
     Hierarchical Partitioning: variance partition of a multivariate data
1881
     set.
1882
 
24285 hornik 1883
*homals*
1884
     Homogeneity Analysis (HOMALS) package with optional Tcl/Tk interface.
1885
 
23612 hornik 1886
*hwde*
1887
     Models and tests for departure from Hardy-Weinberg equilibrium and
1888
     independence between loci.
1889
 
18322 hornik 1890
*ifs*
1891
     Iterated Function Systems distribution function estimator.
1892
 
28100 hornik 1893
*impute*
1894
     Imputation for microarray data (currently KNN only).
1895
 
9196 hornik 1896
*ineq*
1897
     Inequality, concentration and poverty measures, and Lorenz curves
1898
     (empirical and theoretic).
1899
 
18993 hornik 1900
*ipred*
1901
     Improved predictive models by direct and indirect bootstrap aggregation
1902
     in classification and regression as well as resampling based estimators
1903
     of prediction error.
1904
 
24072 hornik 1905
*ismev*
1906
     Functions to support the computations carried out in "An Introduction
1907
     to Statistical Modeling of Extreme Values;' by S. Coles, 2001,
1908
     Springer.  The functions may be divided into the following groups;
1909
     maxima/minima, order statistics, peaks over thresholds and point
1910
     processes.
1911
 
25296 hornik 1912
*its*
1913
     An S4 class for handling irregular time series.
1914
 
28362 murdoch 1915
*kernlab*
1916
     Kernel-based machine learning methods including support vector
1917
     machines.  (Currently in `1.9.0/Other'.)
1918
 
20049 hornik 1919
*knnTree*
19977 hornik 1920
     Construct or predict with k-nearest-neighbor classifiers, using
1921
     cross-validation to select k, choose variables (by forward or
1922
     backwards selection), and choose scaling (from among no scaling,
1923
     scaling each column by its SD, or scaling each column by its MAD).
1924
     The finished classifier will consist of a classification tree with one
1925
     such k-nn classifier in each leaf.
1926
 
27235 hornik 1927
*labstatR*
1928
     Functions for the book "Laboratorio di statistica con R" by S. M.
1929
     Iacus and G. Masarotto, 2002, McGraw-Hill.  Function names and
1930
     documentation in Italian.
1931
 
24353 hornik 1932
*lars*
1933
     Least Angle Regression, Lasso and Forward Stagewise: efficient
1934
     procedures for fitting an entire lasso sequence with the cost of a
1935
     single least squares fit.
1936
 
18166 hornik 1937
*lasso2*
1938
     Routines and documentation for solving regression problems while
1939
     imposing an L1 constraint on the estimates, based on the algorithm of
1940
     Osborne et al. (1998)
1941
 
17467 hornik 1942
*lattice*
1943
     Lattice graphics, an implementation of Trellis Graphics functions.
21379 hornik 1944
     _Recommended_.
17467 hornik 1945
 
27487 hornik 1946
*lazy*
1947
     Lazy learning for local regression.
1948
 
27334 hornik 1949
*ldDesign*
1950
     Design of experiments for detection of linkage disequilibrium,
1951
 
3930 hornik 1952
*leaps*
1953
     A package which performs an exhaustive search for the best subsets of a
1954
     given set of potential regressors, using a branch-and-bound algorithm,
1955
     and also performs searches using a number of less time-consuming
1956
     techniques.
1957
 
14291 hornik 1958
*lgtdl*
1959
     A set of methods for longitudinal data objects.
1960
 
26494 hornik 1961
*linprog*
1962
     Solve linear programming/linear optimization problems by using the
1963
     simplex algorithm.
1964
 
24918 hornik 1965
*lme4*
1966
     Fit linear and generalized linear mixed-effects models.
1967
 
26509 hornik 1968
*lmeSplines*
1969
     Fit smoothing spline terms in Gaussian linear and nonlinear
1970
     mixed-effects models.
1971
 
27079 hornik 1972
*lmm*
1973
     Linear mixed models.
1974
 
4005 hornik 1975
*lmtest*
1976
     A collection of tests on the assumptions of linear regression models
1977
     from the book "The linear regression model under test" by W. Kraemer
6404 hornik 1978
     and H. Sonnberger, 1986, Physica.
4005 hornik 1979
 
23498 hornik 1980
*locfit*
1981
     Local Regression, likelihood and density estimation.
1982
 
26737 hornik 1983
*logistf*
1984
     Firth's bias reduced logistic regression approach with penalized
1985
     profile likelihood based confidence intervals for parameter estimates.
1986
 
3930 hornik 1987
*logspline*
1988
     Logspline density estimation.
1989
 
14663 hornik 1990
*lokern*
1991
     Kernel regression smoothing with adaptive local or global plug-in
1992
     bandwidth selection.
1993
 
26444 hornik 1994
*lpSolve*
1995
     Functions that solve general linear/integer problems, assignment
1996
     problems, and transportation problems via interfacing Lp_solve.
1997
 
14221 hornik 1998
*lpridge*
1999
     Local polynomial (ridge) regression.
2000
 
27214 hornik 2001
*magic*
2002
     A variety of methods for creating magic squares of any order greater
2003
     than 2, and various magic hypercubes.
2004
 
26549 hornik 2005
*mapdata*
2006
     Supplement to package *maps*, providing the larger and/or
2007
     higher-resolution databases.
2008
 
26804 hornik 2009
*mapproj*
2010
     Map Projections: converts latitude/longitude into projected
2011
     coordinates.
2012
 
26549 hornik 2013
*maps*
2014
     Draw geographical maps.  Projection code and larger maps are in
2015
     separate packages.
2016
 
25701 hornik 2017
*maptools*
2018
     Set of tools for manipulating and reading geographic data, in
2019
     particular ESRI shapefiles.
2020
 
9532 hornik 2021
*maptree*
2022
     Functions with example data for graphing and mapping models from
2023
     hierarchical clustering and classification and regression trees.
2024
 
15163 pd 2025
*maxstat*
2026
     Maximally selected rank and Gauss statistics with several p-value
2027
     approximations.
2028
 
21461 hornik 2029
*mclust*
21656 hornik 2030
     Model-based cluster analysis: the 2002 version of MCLUST.
21461 hornik 2031
 
5598 hornik 2032
*mda*
2033
     Code for mixture discriminant analysis (MDA), flexible discriminant
2034
     analysis (FDA), penalized discriminant analysis (PDA), multivariate
2035
     additive regression splines (MARS), adaptive back-fitting splines
2036
     (BRUTO), and penalized regression.
2037
 
27832 hornik 2038
*meanscore*
2039
     Mean Score method for missing covariate data in logistic regression
2040
     models.
2041
 
25181 hornik 2042
*merror*
2043
     Accuracy and precision of measurements.
2044
 
11039 hornik 2045
*mgcv*
11235 hornik 2046
     Routines for GAMs and other genralized ridge regression problems with
21379 hornik 2047
     multiple smoothing parameter selection by GCV or UBRE.  _Recommended_.
11039 hornik 2048
 
22343 hornik 2049
*mimR*
2050
     An R interface to MIM for graphical modeling in R.
2051
 
23925 hornik 2052
*mix*
2053
     Estimation/multiple imputation programs for mixed categorical and
2054
     continuous data.
2055
 
3930 hornik 2056
*mlbench*
2057
     A collection of artificial and real-world machine learning benchmark
2058
     problems, including the Boston housing data.
2059
 
26639 hornik 2060
*mmlcr*
2061
     Mixed-mode latent class regression (also known as mixed-mode mixture
2062
     model regression or mixed-mode mixture regression models) which can
2063
     handle both longitudinal and one-time responses.
2064
 
16612 hornik 2065
*moc*
2066
     Fits a variety of mixtures models for multivariate observations with
2067
     user-difined distributions and curves.
2068
 
28026 hornik 2069
*mscalib*
2070
     Calibration and filtering of MALDI-TOF Peptide Mass Fingerprint data.
2071
 
21835 hornik 2072
*msm*
2073
     Functions for fitting continuous-time Markov multi-state models to
2074
     categorical processes observed at arbitrary times, optionally with
2075
     misclassified responses, and covariates on transition or
2076
     misclassification rates.
2077
 
12190 hornik 2078
*muhaz*
2079
     Hazard function estimation in survival analysis.
2080
 
20186 hornik 2081
*multcomp*
2082
     Multiple comparison procedures for the one-way layout.
2083
 
23959 hornik 2084
*multidim*
2085
     Multidimensional descriptive statistics: factorial methods and
2086
     classification.
2087
 
28362 murdoch 2088
*multinomRob*
2089
     Overdispersed multinomial regression using robust (LQD and tanh)
2090
     estimation.
2091
 
3930 hornik 2092
*multiv*
2093
     Functions for hierarchical clustering, partitioning, bond energy
2094
     algorithm, Sammon mapping, PCA and correspondence analysis.
2095
 
28084 hornik 2096
*mvbutils*
2097
     Utilities by Mark V. Bravington for project organization, editing and
2098
     backup, sourcing, documentation (formal and informal), package
2099
     preparation, macro functions, and more.
2100
 
12210 hornik 2101
*mvnmle*
12192 hornik 2102
     ML estimation for multivariate normal data with missing values.
2103
 
26494 hornik 2104
*mvnormtest*
2105
     Generalization of the Shapiro-Wilk test for multivariate variables.
2106
 
28302 murdoch 2107
*mvpart*
2108
     Multivariate partitioning.
2109
 
11751 hornik 2110
*mvtnorm*
2111
     Multivariate normal and t distributions.
2112
 
26804 hornik 2113
*ncdf*
2114
     Interface to Unidata netCDF data files.
2115
 
24458 hornik 2116
*ncomplete*
2117
     Functions to perform the regression depth method (RDM) to binary
2118
     regression to approximate the minimum number of observations that can
2119
     be removed such that the reduced data set has complete separation.
2120
 
24849 hornik 2121
*negenes*
2122
     Estimating the number of essential genes in a genome on the basis of
2123
     data from a random transposon mutagenesis experiment, through the use
2124
     of a Gibbs sampler.
2125
 
12912 hornik 2126
*netCDF*
2127
     Read data from netCDF files.
2128
 
6717 hornik 2129
*nlme*
2130
     Fit and compare Gaussian linear and nonlinear mixed-effects models.
21379 hornik 2131
     _Recommended_.
6717 hornik 2132
 
25053 hornik 2133
*nlmeODE*
2134
     Combine the *nlme* and *odesolve* packages for mixed-effects modelling
2135
     using differential equations.
2136
 
14173 hornik 2137
*nlrq*
2138
     Nonlinear quantile regression.
2139
 
3930 hornik 2140
*nnet*
2141
     Software for single hidden layer perceptrons ("feed-forward neural
7160 hornik 2142
     networks"), and for multinomial log-linear models.  Contained in the
21379 hornik 2143
     `VR' bundle.  _Recommended_.
3930 hornik 2144
 
27079 hornik 2145
*nor1mix*
2146
     One-dimensional normal mixture models classes, for, e.g., density
2147
     estimation or clustering algorithms research and teaching; providing
2148
     the widely used Marron-Wand densities.
2149
 
6404 hornik 2150
*norm*
2151
     Analysis of multivariate normal datasets with missing values.
2152
 
23959 hornik 2153
*normalp*
2154
     A collection of utilities for normal of order p distributions (General
2155
     Error Distributions).
2156
 
26747 hornik 2157
*nortest*
2158
     Five omnibus tests for the composite hypothesis of normality.
2159
 
24458 hornik 2160
*noverlap*
2161
     Functions to perform the regression depth method (RDM) to binary
2162
     regression to approximate the amount of overlap, i.e., the minimal
2163
     number of observations that need to be removed such that the reduced
2164
     data set has no longer overlap.
2165
 
18783 hornik 2166
*npmc*
2167
     Nonparametric Multiple Comparisons:  provides simultaneous rank test
2168
     procedures for the one-way layout without presuming a certain
2169
     distribution.
2170
 
25947 hornik 2171
*nprq*
2172
     Nonparametric and sparse quantile regression methods.
2173
 
12712 hornik 2174
*odesolve*
2175
     An interface for the Ordinary Differential Equation (ODE) solver lsoda.
2176
     ODEs are expressed as R functions.
2177
 
25130 hornik 2178
*orientlib*
2179
     Representations, conversions and display of orientation SO(3) data.
2180
 
3930 hornik 2181
*oz*
2182
     Functions for plotting Australia's coastline and state boundaries.
2183
 
24414 hornik 2184
*pamr*
2185
     Pam: Prediction Analysis for Microarrays.
2186
 
27036 hornik 2187
*pan*
2188
     Multiple imputation for multivariate panel or clustered data.
2189
 
14291 hornik 2190
*panel*
2191
     Functions and datasets for fitting models to Panel data.
2192
 
18045 hornik 2193
*pastecs*
2194
     Package for Analysis of Space-Time Ecological Series.
2195
 
15168 pd 2196
*pcurve*
2197
     Fits a principal curve to a numeric multivariate dataset in arbitrary
2198
     dimensions.  Produces diagnostic plots.  Also calculates Bray-Curtis
2199
     and other distance matrices and performs multi-dimensional scaling and
2200
     principal component analyses.
2201
 
17759 hornik 2202
*pear*
2203
     Periodic Autoregression Analysis.
2204
 
14291 hornik 2205
*permax*
2206
     Functions intended to facilitate certain basic analyses of DNA array
2207
     data, especially with regard to comparing expression levels between two
2208
     types of tissue.
2209
 
27487 hornik 2210
*pheno*
2211
     Some easy-to-use functions for time series analyses of (plant-)
2212
     phenological data sets.
2213
 
27334 hornik 2214
*phyloarray*
2215
     Software to process data from phylogenetic or identification
2216
     microarrays.
2217
 
14362 hornik 2218
*pinktoe*
2219
     Converts S trees to HTML/Perl files for interactive tree traversal.
2220
 
16001 hornik 2221
*pixmap*
2222
     Functions for import, export, plotting and other manipulations of
2223
     bitmapped images.
2224
 
23925 hornik 2225
*pls.pcr*
2226
     Multivariate regression by PLS and PCR.
2227
 
22173 hornik 2228
*polspline*
2229
     Routines for the polynomial spline fitting routines hazard regression,
2230
     hazard estimation with flexible tails, logspline, lspec, polyclass, and
2231
     polymars, by C. Kooperberg and co-authors.
2232
 
3930 hornik 2233
*polynom*
2234
     A collection of functions to implement a class for univariate
2235
     polynomial manipulations.
2236
 
25344 hornik 2237
*pps*
2238
     Functions to select samples using PPS (probability proportional to
2239
     size) sampling, for stratified simple random sampling, and to compute
2240
     joint inclusion probabilities for Sampford's method of PPS sampling.
2241
 
24976 hornik 2242
*prabclus*
2243
     Distance based parametric bootstrap tests for clustering, mainly
2244
     thought for presence-absence data (clustering of species distribution
2245
     maps).  Jaccard and Kulczynski distance measures, clustering of MDS
2246
     scores, and nearest neighbor based noise detection.
2247
 
4562 pd 2248
*princurve*
4035 hornik 2249
     Fits a principal curve to a matrix of points in arbitrary dimension.
3930 hornik 2250
 
2251
*pspline*
2252
     Smoothing splines with penalties on order m derivatives.
2253
 
25850 hornik 2254
*psy*
2255
     Various procedures used in psychometry: Kappa, ICC, Cronbach alpha,
2256
     screeplot, PCA and related methods.
2257
 
16521 hornik 2258
*qtl*
2259
     Analysis of experimental crosses to identify QTLs.
2260
 
3930 hornik 2261
*quadprog*
2262
     For solving quadratic programming problems.
2263
 
2264
*quantreg*
19081 hornik 2265
     Quantile regression and related methods.
3930 hornik 2266
 
20082 hornik 2267
*qvcalc*
2268
     Functions to compute quasi-variances and associated measures of
2269
     approximation error.
2270
 
19081 hornik 2271
*randomForest*
2272
     Breiman's random forest classifier.
2273
 
28362 murdoch 2274
*ref*
2275
     Functions for creating references, reading from and writing ro
2276
     references and a memory efficient refdata type that transparently
2277
     encapsulates matrices and data frames.
2278
 
20082 hornik 2279
*relimp*
2280
     Functions to facilitate inference on the relative importance of
2281
     predictors in a linear or generalized linear model.
2282
 
27235 hornik 2283
*rgdal*
2284
     Provides bindings to Frank Warmerdam's Geospatial Data Abstraction
2285
     Library (GDAL).
2286
 
21570 hornik 2287
*rgenoud*
2288
     R version of GENetic Optimization Using Derivatives.
2289
 
23969 hornik 2290
*rimage*
2291
     Functions for image processing, including Sobel filter, rank filters,
2292
     fft, histogram equalization, and reading JPEG files.
2293
 
5598 hornik 2294
*rmeta*
2295
     Functions for simple fixed and random effects meta-analysis for
2296
     two-sample comparison of binary outcomes.
2297
 
3930 hornik 2298
*rpart*
21379 hornik 2299
     Recursive PARTitioning and regression trees.  _Recommended_.
3930 hornik 2300
 
15925 hornik 2301
*rpvm*
2302
     R interface to PVM (Parallel Virtual Machine).  Provides interface to
2303
     PVM APIs, and examples and documentation for its use.
2304
 
25579 hornik 2305
*rqmcmb2*
2306
     Markov chain marginal bootstrap for quantile regression.
2307
 
19445 hornik 2308
*rsprng*
2309
     Provides interface to SPRNG (Scalable Parallel Random Number
2310
     Generators) APIs, and examples and documentation for its use.
2311
 
24411 hornik 2312
*sampfling*
2313
     Implements a modified version of the Sampford sampling algorithm.
2314
     Given a quantity assigned to each unit in the population, samples are
2315
     drawn with probability proportional to te product of the quantities of
2316
     the units included in the sample.
2317
 
25238 hornik 2318
*sca*
2319
     Simple Component Analysis.
2320
 
11419 hornik 2321
*scatterplot3d*
2322
     Plots a three dimensional (3D) point cloud perspectively.
2323
 
26282 hornik 2324
*seacarb*
2325
     Calculates parameters of the seawater carbonate system.
2326
 
25105 hornik 2327
*seao*
2328
     Simple Evolutionary Algorithm Optimization.
2329
 
25130 hornik 2330
*seao.gui*
2331
     Simple Evolutionary Algorithm Optimization: graphical user interface.
2332
 
26549 hornik 2333
*segmented*
2334
     Functions to estimate break-points of segmented relationships in
2335
     regression models (GLMs).
2336
 
15255 hornik 2337
*sem*
2338
     Functions for fitting general linear Structural Equation Models (with
2339
     observed and unobserved variables) by the method of maximum likelihood
2340
     using the RAM approach.
2341
 
19543 hornik 2342
*serialize*
2343
     Simple interfce for serializing to connections.
2344
 
23668 hornik 2345
*session*
2346
     Functions for interacting with, saving and restoring R sessions.
2347
 
3930 hornik 2348
*sgeostat*
2349
     An object-oriented framework for geostatistical modeling.
2350
 
24729 hornik 2351
*shapefiles*
2352
     Functions to read and write ESRI shapefiles.
2353
 
26253 hornik 2354
*shapes*
2355
     Routines for the statistical analysis of shapes, including procrustes
2356
     analysis, displaying shapes and principal components, testing for mean
2357
     shape difference, thin-plate spline transformation grids and edge
2358
     superimposition methods.
2359
 
26570 hornik 2360
*simpleboot*
2361
     Simple bootstrap routines.
2362
 
3930 hornik 2363
*sm*
2364
     Software linked to the book "Applied Smoothing Techniques for Data
2365
     Analysis:  The Kernel Approach with S-PLUS Illustrations" by A. W.
6404 hornik 2366
     Bowman and A. Azzalini (1997), Oxford University Press.
3930 hornik 2367
 
21387 hornik 2368
*sma*
2369
     Functions for exploratory (statistical) microarray analysis.
2370
 
26737 hornik 2371
*smoothSurv*
2372
     Survival regression with smoothed error distribution.
2373
 
10696 hornik 2374
*sn*
2375
     Functions for manipulating skew-normal probability distributions and
2376
     for fitting them to data, in the scalar and the multivariate case.
2377
 
25053 hornik 2378
*sna*
2379
     A range of tools for social network analysis, including node and
2380
     graph-level indices, structural distance and covariance methods,
2381
     structural equivalence detection, p* modeling, and network
2382
     visualization.
2383
 
23569 hornik 2384
*snow*
2385
     Simple Network of Workstations: support for simple parallel computing
2386
     in R.
2387
 
26494 hornik 2388
*som*
2389
     Self-Organizing Maps (with application in gene clustering).
2390
 
21111 hornik 2391
*sound*
2392
     A sound interface for R: Basic functions for dealing with `.wav' files
2393
     and sound samples.
2394
 
3930 hornik 2395
*spatial*
5042 hornik 2396
     Functions for kriging and point pattern analysis from "Modern Applied
21379 hornik 2397
     Statistics with S" by W. Venables and B. Ripley.  Contained in the
2398
     `VR' bundle.  _Recommended_.
3930 hornik 2399
 
17909 hornik 2400
*spatstat*
2401
     Data analysis and modelling of two-dimensional point patterns,
2402
     including multitype points and spatial covariates.
2403
 
18783 hornik 2404
*spdep*
2405
     A collection of functions to create spatial weights matrix objects from
2406
     polygon contiguities, from point patterns by distance and tesselations,
2407
     for summarising these objects, and for permitting their use in spatial
2408
     data analysis; a collection of tests for spatial autocorrelation,
2409
     including global Moran's I and Geary's C, local Moran's I, saddlepoint
2410
     approximations for global and local Moran's I; and functions for
19445 hornik 2411
     estimating spatial simultaneous autoregressive (SAR) models.  (Was
2412
     formerly the three packages: *spweights*, *sptests*, and *spsarlm*.)
18783 hornik 2413
 
11218 hornik 2414
*splancs*
2415
     Spatial and space-time point pattern analysis functions.
2416
 
23233 hornik 2417
*statmod*
2418
     Miscellaneous biostatistical modelling functions.
2419
 
15163 pd 2420
*strucchange*
2421
     Various tests on structural change in linear regression models.
2422
 
18666 hornik 2423
*subselect*
2424
     A collection of functions which assess the quality of variable subsets
2425
     as surrogates for a full data set, and search for subsets which are
2426
     optimal under various criteria.
2427
 
28001 hornik 2428
*supclust*
2429
     Methodology for supervised grouping of predictor variables.
2430
 
22792 hornik 2431
*survey*
2432
     Summary statistics, generalized linear models, and general maximum
2433
     likelihood estimation for stratified, cluster-sampled, unequally
2434
     weighted survey samples.
2435
 
14720 hornik 2436
*survival*
2437
     Functions for survival analysis, including penalised likelihood.
21379 hornik 2438
     _Recommended_.
5042 hornik 2439
 
21705 hornik 2440
*survrec*
2441
     Survival analysis for recurrent event data.
2442
 
19977 hornik 2443
*systemfit*
2444
     Contains functions for fitting simultaneous systems of equations using
2445
     Ordinary Least Sqaures (OLS), Two-Stage Least Squares (2SLS), and
2446
     Three-Stage Least Squares (3SLS).
2447
 
25205 hornik 2448
*tapiR*
2449
     Tools for accessing (UK) parliamentary information in R.
2450
 
11235 hornik 2451
*tensor*
2452
     Tensor product of arrays.
2453
 
19483 hornik 2454
*tkrplot*
2455
     Simple mechanism for placing R graphics in a Tk widget.
2456
 
3930 hornik 2457
*tree*
2458
     Classification and regression trees.
2459
 
2460
*tripack*
2461
     A constrained two-dimensional Delaunay triangulation package.
2462
 
5598 hornik 2463
*tseries*
11235 hornik 2464
     Package for time series analysis with emphasis on non-linear modelling.
5598 hornik 2465
 
27832 hornik 2466
*twostage*
2467
     Functions for optimal design of two-stage-studies using the Mean Score
2468
     method.
2469
 
26538 hornik 2470
*udunits*
2471
     Interface to Unidata's routines to convert units.
2472
 
24458 hornik 2473
*vardiag*
2474
     Interactive variogram diagnostics.
2475
 
22321 hornik 2476
*vcd*
2477
     Functions and data sets based on the book "Visualizing Categorical
2478
     Data" by Michael Friendly.
2479
 
15925 hornik 2480
*vegan*
2481
     Various help functions for vegetation scientists and community
2482
     ecologists.
2483
 
16438 hornik 2484
*waveslim*
2485
     Basic wavelet routines for time series analysis.
2486
 
6155 pd 2487
*wavethresh*
2488
     Software to perform 1-d and 2-d wavelet statistics and transforms.
2489
 
9438 hornik 2490
*wle*
2491
     Robust statistical inference via a weighted likelihood approach.
2492
 
3930 hornik 2493
*xgobi*
6404 hornik 2494
     Interface to the XGobi and XGvis programs for graphical data analysis.
3930 hornik 2495
 
11810 hornik 2496
*xtable*
2497
     Export data to LaTeX and HTML tables.
2498
 
11765 hornik 2499
See CRAN `src/contrib/PACKAGES' for more information.
5042 hornik 2500
 
3930 hornik 2501
   There is also a CRAN `src/contrib/Devel' directory which contains
2502
packages still "under development" or depending on features only present in
2503
the current development versions of R.  Volunteers are invited to give
2504
these a try, of course.  This area of CRAN currently contains
2505
 
21306 hornik 2506
*Dopt*
2507
     Finding D-optimal experimental designs.
2508
 
26562 hornik 2509
*GLMMGibbs*
2510
     Generalised Linear Mixed Models by Gibbs sampling.
2511
 
21379 hornik 2512
*RPgSQL*
2513
     Provides methods for accessing data stored in PostgreSQL tables.
2514
 
24270 hornik 2515
*Rmpi*
2516
     An interface (wrapper) to MPI (Message-Passing Interface) APIs.  It
2517
     also provides interactive R slave functionalities to make MPI
2518
     programming easier in R than in C(++) or FORTRAN.
2519
 
10759 hornik 2520
*dseplus*
2521
     Extensions to *dse*, the Dynamic Systems Estimation multivariate time
2522
     series package.  Contains PADI, juice and monitoring extensions.
8964 hornik 2523
 
12256 pd 2524
*ensemble*
2525
     Ensembles of tree classifiers.
2526
 
21273 hornik 2527
*runStat*
21271 hornik 2528
     Running median and mean.
2529
 
11982 hornik 2530
*write.snns*
2531
     Function for writing a SNNS pattern file from a data frame or matrix.
3930 hornik 2532
 
24583 hornik 2533
5.1.3 Add-on packages from Omegahat
2534
-----------------------------------
11573 hornik 2535
 
26562 hornik 2536
The `src/contrib/Omegahat' Directory of a CRAN site contains yet unreleased
2537
packages from the Omegahat Project for Statistical Computing
24583 hornik 2538
(http://www.omegahat.org/).  Currently, there are
2539
 
11853 hornik 2540
*CORBA*
2541
     Dynamic CORBA client/server facilities for R.  Connects to other
2542
     CORBA-aware applications developed in arbitrary languages, on different
2543
     machines and allows R functionality to be exported in the same way to
2544
     other applications.
2545
 
13459 hornik 2546
*OOP*
2547
     OOP style classes and methods for R and S-PLUS.  Object references and
2548
     class-based method definition are supported in the style of languages
2549
     such as Java and C++.
2550
 
14689 hornik 2551
*REmbeddedPostgres*
2552
     Allows R functions and objects to be used to implement SQL functions --
2553
     per-record, aggregate and trigger functions.
2554
 
22655 hornik 2555
*REventLoop*
2556
     An abstract event loop mechanism that is toolkit independent and can be
2557
     used to to replace the R event loop.
2558
 
2559
*RGdkPixbuf*
2560
     S language functions to access the facilities in the GdkPixbuf library
2561
     for manipulating images.
2562
 
14689 hornik 2563
*RGnumeric*
2564
     A plugin for the Gnumeric spreadsheet that allows R functions to be
2565
     called from cells within the sheet, automatic recalculation, etc.
2566
 
22655 hornik 2567
*RGtk*
2568
     Facilities in the S language for programming graphical interfaces using
2569
     Gtk, the Gnome GUI toolkit.
2570
 
21400 hornik 2571
*RGtkBindingGenerator*
2572
     A meta-package which generates C and R code to provide bindings to a
2573
     Gtk-based library.
2574
 
22655 hornik 2575
*RGtkExtra*
2576
     A collection of S functions that provide an interface to the widgets in
2577
     the gtk+extra library such as the GtkSheet data-grid display, icon
2578
     list, file list and directory tree.
2579
 
2580
*RGtkGlade*
2581
     S language bindings providing an interface to Glade, the interactive
2582
     Gnome GUI creator.
2583
 
2584
*RGtkHTML*
2585
     A collection of S functions that provide an interface to creating and
2586
     controlling an HTML widget which can be used to display HTML documents
2587
     from files or content generated dynamically in S.
2588
 
19764 hornik 2589
*RGtkViewers*
2590
     A collection of tools for viewing different S objects, databases, class
2591
     and widget hierarchies, S source file contents, etc.
2592
 
15168 pd 2593
*RJavaDevice*
22632 hornik 2594
     A graphics device for R that uses Java components and graphics.  APIs.
15168 pd 2595
 
22632 hornik 2596
*RObjectTables*
2597
     The C and S code allows one to define R objects to be used as elements
2598
     of the search path with their own semantics and facilities for reading
2599
     and writing variables.  The objects implement a simple interface via R
2600
     functions (either methods or closures) and can access external data,
2601
     e.g., in other applications, languages, formats, ...
2602
 
11802 hornik 2603
*RSMethods*
2604
     An implementation of S version 4 methods and classes for R, consistent
20969 hornik 2605
     with the basic material in "Programming with Data" by John M.
11802 hornik 2606
     Chambers, 1998, Springer NY.
2607
 
11573 hornik 2608
*RSPerl*
2609
     An interface from R to an embedded, persistent Perl interpreter,
2610
     allowing one to call arbitrary Perl subroutines, classes and methods.
2611
 
13960 hornik 2612
*RSPython*
2613
     Allows Python programs to invoke S functions, methods, etc., and S code
2614
     to call Python functionality.
2615
 
20969 hornik 2616
*RXLisp*
2617
     An interface to call XLisp-Stat functions from within R.
2618
 
15675 hornik 2619
*SASXML*
2620
     Example for reading XML files in SAS 8.2 manner.
2621
 
13029 hornik 2622
*SJava*
2623
     An interface from R to Java to create and call Java objects and
2624
     methods.
2625
 
12102 hornik 2626
*SLanguage*
2627
     Functions and C support utilities to support S language programming
2628
     that can work in both R and S-PLUS.
2629
 
13029 hornik 2630
*SNetscape*
2631
     Plugin for Netscape and JavaScript.
2632
 
22655 hornik 2633
*SWinRegistry*
2634
     Provides access from within R to read and write the Windows registry.
2635
 
2636
*SWinTypeLibs*
2637
     Provides ways to extract type information from type libraries and/or
2638
     DCOM objects that describes the methods, properties, etc. of an
2639
     interface.
2640
 
13960 hornik 2641
*SXalan*
2642
     Process XML documents using XSL functions implemented in R and
2643
     dynamically substituting output from R.
2644
 
14689 hornik 2645
*Slcc*
2646
     Parses C source code, allowing one to analyze and automatically
2647
     generate interfaces from S to that code, including the table of
2648
     S-accessible native symbols, parameter count and type information, S
2649
     constructors from C objects, call graphs, etc.
2650
 
15675 hornik 2651
*Sxslt*
2652
     An extension module for libxslt, the XML-XSL document translator, that
2653
     allows XSL functions to be implemented via R functions.
2654
 
24583 hornik 2655
5.1.4 Add-on packages from BioConductor
2656
---------------------------------------
2657
 
26562 hornik 2658
The Bioconductor Project (http://www.bioconductor.org) produces an open
19543 hornik 2659
source software framework that will assist biologists and statisticians
2660
working in bioinformatics, with primary emphasis on inference using DNA
24551 hornik 2661
microarrays.  The following R packages are contained in the current release
2662
of BioConductor, with more packages under development.
19543 hornik 2663
 
2664
*AnnBuilder*
24551 hornik 2665
     Assemble and process genomic annotation data, from databases such as
2666
     GenBank, the Gene Ontology Consortium, LocusLink, UniGene, the UCSC
2667
     Human Genome Project.
19543 hornik 2668
 
2669
*Biobase*
24551 hornik 2670
     Object-oriented representation and manipulation of genomic data (S4
2671
     class structure).
19543 hornik 2672
 
24551 hornik 2673
*DynDoc*
2674
     Functionality to create and interact with dynamic documents, vignettes,
2675
     and other navigable documents.
2676
 
26816 hornik 2677
*MAGEML*
2678
     Functionality to handle MAGEML documents.
2679
 
24551 hornik 2680
*RBGL*
2681
     An interface between the graph package and the Boost graph libraries,
2682
     allowing for fast manipulation of graph objects in R.
2683
 
19543 hornik 2684
*ROC*
24551 hornik 2685
     Receiver Operating Characteristic (ROC) approach for identifying genes
2686
     that are differentially expressed in two types of samples.
19543 hornik 2687
 
26816 hornik 2688
*RdbiPgSQL*
2689
     Methods for accessing data stored in PostgreSQL tables.
2690
 
24551 hornik 2691
*Rgraphviz*
2692
     An interface with Graphviz for plotting graph objects in R.
2693
 
2694
*Ruuid*
2695
     Creates Universally Unique ID values (UUIDs) in R.
2696
 
2697
*SAGElyzer*
2698
     Locates genes based on SAGE tags.
2699
 
26816 hornik 2700
*SNPtools*
2701
     Rudimentary structures for SNP data.
2702
 
19543 hornik 2703
*affy*
2704
     Methods for Affymetrix Oligonucleotide Arrays.
2705
 
26816 hornik 2706
*affyPLM*
2707
     For fitting Probe Level Models.
2708
 
24551 hornik 2709
*affycomp*
2710
     Graphics toolbox for assessment of Affymetrix expression measures.
2711
 
2712
*affydata*
2713
     Affymetrix data for demonstration purposes.
2714
 
26816 hornik 2715
*annaffy*
2716
     Functions for handling data from Bioconductor Affymetrix annotation
2717
     data packages.
2718
 
19543 hornik 2719
*annotate*
24551 hornik 2720
     Associate experimental data in real time to biological metadata from
2721
     web databases such as GenBank, LocusLink and PubMed.  Process and store
2722
     query results.  Generate HTML reports of analyses.
19543 hornik 2723
 
26816 hornik 2724
*ctc*
2725
     Tools to export and import Tree and Cluster to other programs.
2726
 
2727
*daMA*
2728
     Functions for the efficient design of factorial two-color microarray
2729
     experiments and for the statistical analysis of factorial microarray
2730
     data.
2731
 
19543 hornik 2732
*edd*
24551 hornik 2733
     Expression density diagnostics: graphical methods and pattern
2734
     recognition algorithms for distribution shape classification.
19543 hornik 2735
 
26816 hornik 2736
*externalVector*
2737
     Basic class definitions and generics for external pointer based vector
2738
     objects for R.
2739
 
2740
*factDesign*
2741
     A set of tools for analyzing data from factorial designed micraorray
2742
     experiments.  The functions can be used to evaluate appropriate tests
2743
     of contrast and perform single outlier detection.
2744
 
2745
*gcrma*
2746
     Background adjustment using sequence information.
2747
 
19543 hornik 2748
*genefilter*
24551 hornik 2749
     Tools for sequentially filtering genes using a wide variety of
2750
     filtering functions.  Example of filters include: number of missing
2751
     value, coefficient of variation of expression measures, ANOVA p-value,
2752
     Cox model p-values.  Sequential application of filtering functions to
2753
     genes.
19543 hornik 2754
 
2755
*geneplotter*
24551 hornik 2756
     Graphical tools for genomic data, for example for plotting expression
2757
     data along a chromosome or producing color images of expression data
2758
     matrices.
19543 hornik 2759
 
26816 hornik 2760
*globaltest*
2761
     Testing globally whether a group of genes is significantly related to
2762
     some clinical variable of interest.
2763
 
2764
*gpls*
2765
     Classification using generalized partial least squares for two-group
2766
     and multi-group classification.
2767
 
24551 hornik 2768
*graph*
2769
     Classes and tools for creating and manipulating graphs within R.
2770
 
2771
*hexbin*
2772
     Binning functions, in particular hexagonal bins for graphing.
2773
 
2774
*limma*
2775
     Linear models for microarray data.
2776
 
26816 hornik 2777
*makecdfenv*
2778
     Two functions.  One reads a Affymetrix chip description file (CDF) and
2779
     creates a hash table environment containing the location/probe set
2780
     membership mapping.  The other creates a package that automatically
2781
     loads that environment.
2782
 
19543 hornik 2783
*marrayClasses*
2784
     Class definitions for pre-normalized and normalized cDNA microarray
2785
     data.  Basic methods for accessing/replacing, printing, and subsetting.
2786
 
2787
*marrayInput*
2788
     Functions for reading microarray data into R from different image
2789
     analysis output files, and probe and target description files.  Widgets
2790
     are supplied to facilitate and automate data input and the creation of
2791
     microarray specific R objects for storing these data.
2792
 
2793
*marrayNorm*
2794
     Functions for location and scale normalization procedures based on
2795
     robust local regression.
2796
 
2797
*marrayPlots*
2798
     Functions for diagnostic plots for pre- and post-normalization cDNA
2799
     microarray intensity data: boxplots, scatter-plots, color images.
2800
 
24551 hornik 2801
*marrayTools*
2802
     Miscellaneous functions used in the functional genomics core facility
2803
     in UCB and UCSF.
2804
 
26816 hornik 2805
*matchprobes*
2806
     ools for sequence matching of probes on arrays.
2807
 
19543 hornik 2808
*multtest*
24551 hornik 2809
     Multiple testing procedures for controlling the family-wise error rate
2810
     (FWER) and the false discovery rate (FDR).  Tests can be based on t-
2811
     or F-statistics for one- and two-factor designs, and permutation
2812
     procedures are available to estimate adjusted p-values.
19543 hornik 2813
 
26816 hornik 2814
*ontoTools*
2815
     Graphs and sparse matrices for working with ontologies.
2816
 
2817
*pamr*
2818
     Pam: prediction analysis for microarrays.
2819
 
24551 hornik 2820
*reposTools*
2821
     Tools for dealing with file repositories and allow users to easily
2822
     install, update, and distribute packages, vignettes, and other files.
2823
 
19543 hornik 2824
*rhdf5*
24551 hornik 2825
     Storage and retrieval of large datasets using the HDF5 library and file
2826
     format.
19543 hornik 2827
 
26816 hornik 2828
*siggenes*
2829
     Identifying differentially expressed genes and estimating the False
2830
     Discovery Rate (FDR) with both the Significance Analysis of Microarrays
2831
     (SAM) and the Empirical Bayes Analyses of Microarrays (EBAM).
2832
 
2833
*splicegear*
2834
     A set of tools to work with alternative splicing.
2835
 
19543 hornik 2836
*tkWidgets*
24551 hornik 2837
     Widgets in Tcl/Tk that provide functionality for Bioconductor packages.
19543 hornik 2838
 
24551 hornik 2839
*vsn*
2840
     Calibration and variance stabilizing transformations for both
2841
     Affymetrix and cDNA array data.
19543 hornik 2842
 
24551 hornik 2843
*widgetTools*
2844
     Tools for creating Tcl/Tk widgets, i.e., small-scale graphical user
2845
     interfaces.
2846
 
24583 hornik 2847
5.1.5 Other add-on packages
2848
---------------------------
2849
 
26562 hornik 2850
Jim Lindsey <jlindsey@luc.ac.be> has written a collection of R packages for
2851
nonlinear regression and repeated measurements, consisting of *event*
8649 hornik 2852
(event history procedures and models), *gnlm* (generalized nonlinear
2853
regression models), *growth* (multivariate normal and
2854
elliptically-contoured repeated measurements models), *repeated*
2855
(non-normal repeated measurements models), *rmutil* (utilities for
2856
nonlinear regression and repeated measurements), and *stable* (probability
2857
functions and generalized regression models for stable distributions).  All
2858
analyses in the new edition of his book "Models for Repeated Measurements"
2859
(1999, Oxford University Press) were carried out using these packages.  Jim
2860
has also started *dna*, a package with procedures for the analysis of DNA
2861
sequences.  Jim's packages can be obtained from
2862
`http://www.luc.ac.be/~jlindsey/rcode.html'.
6098 pd 2863
 
26253 hornik 2864
   More code has been posted to the R-help mailing list, and can be
3930 hornik 2865
obtained from the mailing list archive.
2866
 
5042 hornik 2867
5.2 How can add-on packages be installed?
4035 hornik 2868
=========================================
3930 hornik 2869
 
26562 hornik 2870
(Unix only.)  The add-on packages on CRAN come as gzipped tar files named
2871
`PKG_VERSION.tar.gz', which may in fact be "bundles" containing more than
2872
one package.  Provided that `tar' and `gzip' are available on your system,
2873
type
3930 hornik 2874
 
11527 hornik 2875
     $ R CMD INSTALL /path/to/PKG_VERSION.tar.gz
3930 hornik 2876
 
14720 hornik 2877
at the shell prompt to install to the library tree rooted at the first
2878
directory given in `R_LIBS' (see below) if this is set and non-null, and to
19445 hornik 2879
the default library (the `library' subdirectory of ``R_HOME'') otherwise.
14720 hornik 2880
(Versions of R prior to 1.3.0 installed to the default library by default.)
3930 hornik 2881
 
14720 hornik 2882
   To install to another tree (e.g., your private one), use
2883
 
11527 hornik 2884
     $ R CMD INSTALL -l LIB /path/to/PKG_VERSION.tar.gz
3930 hornik 2885
 
2886
where LIB gives the path to the library tree to install to.
2887
 
7160 hornik 2888
   Even more conveniently, you can install and automatically update
8384 hornik 2889
packages from within R if you have access to CRAN.  See the help page for
2890
`CRAN.packages()' for more information.
6098 pd 2891
 
3930 hornik 2892
   You can use several library trees of add-on packages.  The easiest way
5598 hornik 2893
to tell R to use these is via the environment variable `R_LIBS' which
2894
should be a colon-separated list of directories at which R library trees
2895
are rooted.  You do not have to specify the default tree in `R_LIBS'.
2896
E.g., to use a private tree in `$HOME/lib/R' and a public site-wide tree in
8384 hornik 2897
`/usr/local/lib/R-contrib', put
3930 hornik 2898
 
8384 hornik 2899
     R_LIBS="$HOME/lib/R:/usr/local/lib/R-contrib"; export R_LIBS
3930 hornik 2900
 
12174 hornik 2901
into your (Bourne) shell profile or even preferably, add the line
3930 hornik 2902
 
12174 hornik 2903
     R_LIBS="$HOME/lib/R:/usr/local/lib/R-contrib"
2904
 
2905
your `~/.Renviron' file.  (Note that no `export' statement is needed or
2906
allowed in this file; see the on-line help for `Startup' for more
2907
information.)
2908
 
5042 hornik 2909
5.3 How can add-on packages be used?
4035 hornik 2910
====================================
3930 hornik 2911
 
26562 hornik 2912
To find out which additional packages are available on your system, type
3930 hornik 2913
 
2914
     library()
2915
 
2916
at the R prompt.
2917
 
2918
   This produces something like
2919
 
2920
     Packages in `/home/me/lib/R':
2921
 
14720 hornik 2922
     mystuff       My own R functions, nicely packaged but not documented
3930 hornik 2923
 
2924
     Packages in `/usr/local/lib/R/library':
2925
 
14720 hornik 2926
     KernSmooth    Functions for kernel smoothing for Wand & Jones (1995)
2927
     MASS          Main Library of Venables and Ripley's MASS
2928
     base          The R base package
2929
     boot          Bootstrap R (S-Plus) Functions (Canty)
2930
     class         Functions for classification
2931
     cluster       Functions for clustering (by Rousseeuw et al.)
2932
     ctest         Classical Tests
2933
     eda           Exploratory Data Analysis
2934
     foreign       Read data stored by Minitab, S, SAS, SPSS, Stata, ...
19445 hornik 2935
     grid          The Grid Graphics Package
2936
     lattice       Lattice Graphics
14720 hornik 2937
     lqs           Resistant Regression and Covariance Estimation
26253 hornik 2938
     methods       Formal Methods and Classes
2939
     mle           Maximum likelihood estimation
14720 hornik 2940
     mgcv          Multiple smoothing parameter estimation and GAMs by GCV
2941
     modreg        Modern Regression: Smoothing and Local Methods
2942
     mva           Classical Multivariate Analysis
2943
     nlme          Linear and nonlinear mixed effects models
2944
     nls           Nonlinear regression
2945
     nnet          Feed-forward neural networks and multinomial log-linear
2946
                   models
2947
     rpart         Recursive partitioning
2948
     spatial       functions for kriging and point pattern analysis
2949
     splines       Regression Spline Functions and Classes
2950
     stepfun       Step Functions, including Empirical Distributions
2951
     survival      Survival analysis, including penalised likelihood
26253 hornik 2952
     tcltk         Tcl/Tk Interface
19445 hornik 2953
     tools         Tools for Package Development and Administration
14720 hornik 2954
     ts            Time series functions
3930 hornik 2955
 
2956
   You can "load" the installed package PKG by
2957
 
2958
     library(PKG)
2959
 
2960
   You can then find out which functions it provides by typing one of
2961
 
12045 hornik 2962
     library(help = PKG)
3930 hornik 2963
     help(package = PKG)
2964
 
2965
   You can unload the loaded package PKG by
2966
 
2967
     detach("package:PKG")
2968
 
5042 hornik 2969
5.4 How can add-on packages be removed?
4035 hornik 2970
=======================================
3930 hornik 2971
 
26562 hornik 2972
Use
3930 hornik 2973
 
11527 hornik 2974
     $ R CMD REMOVE PKG_1 ... PKG_N
3930 hornik 2975
 
14729 hornik 2976
to remove the packages PKG_1, ..., PKG_N from the library tree rooted at
2977
the first directory given in `R_LIBS' if this is set and non-null, and from
2978
the default library otherwise.  (Versions of R prior to 1.3.0 removed from
2979
the default library by default.)
14720 hornik 2980
 
14729 hornik 2981
   To remove from library LIB, do
2982
 
11527 hornik 2983
     $ R CMD REMOVE -l LIB PKG_1 ... PKG_N
3930 hornik 2984
 
5042 hornik 2985
5.5 How can I create an R package?
4035 hornik 2986
==================================
3930 hornik 2987
 
26562 hornik 2988
A package consists of a subdirectory containing the files `DESCRIPTION' and
2989
`INDEX', and the subdirectories `R', `data', `demo', `exec', `inst', `man',
2990
`src', and `tests' (some of which can be missing).  Optionally the package
2991
can also contain script files `configure' and `cleanup' which are executed
2992
before and after installation.
3930 hornik 2993
 
8277 hornik 2994
   See section "Creating R packages" in `Writing R Extensions', for details.
8384 hornik 2995
This manual is included in the R distribution, *note What documentation
2996
exists for R?::, and gives information on package structure, the configure
2997
and cleanup mechanisms, and on automated package checking and building.
3930 hornik 2998
 
14720 hornik 2999
   R version 1.3.0 has added the function `package.skeleton()' which will
3000
set up directories, save data and code, and create skeleton help files for
3001
a set of R functions and datasets.
14204 hornik 3002
 
5042 hornik 3003
   *Note What is CRAN?::, for information on uploading a package to CRAN.
3930 hornik 3004
 
5042 hornik 3005
5.6 How can I contribute to R?
4035 hornik 3006
==============================
3930 hornik 3007
 
26562 hornik 3008
R is in active development and there is always a risk of bugs creeping in.
3009
Also, the developers do not have access to all possible machines capable of
3010
running R.  So, simply using it and communicating problems is certainly of
3011
great value.
3930 hornik 3012
 
3013
   One place where functionality is still missing is the modeling software
6536 hornik 3014
as described in "Statistical Models in S" (see *Note What is S?::);
12026 hornik 3015
Generalized Additive Models (*note Are GAMs implemented in R?::) and some
3016
of the nonlinear modeling code are not there yet.
3930 hornik 3017
 
26253 hornik 3018
   The R Developer Page (http://developer.R-project.org/) acts as an
7045 hornik 3019
intermediate repository for more or less finalized ideas and plans for the
3020
R statistical system.  It contains (pointers to) TODO lists, RFCs, various
11353 hornik 3021
other writeups, ideas lists, and CVS miscellanea.
3930 hornik 3022
 
3023
   Many (more) of the packages available at the Statlib S Repository might
3024
be worth porting to R.
3025
 
3026
   If you are interested in working on any of these projects, please notify
26253 hornik 3027
Kurt Hornik <Kurt.Hornik@R-project.org>.
3930 hornik 3028
 
4035 hornik 3029
6 R and Emacs
3030
*************
3930 hornik 3031
 
5042 hornik 3032
6.1 Is there Emacs support for R?
4035 hornik 3033
=================================
3930 hornik 3034
 
26562 hornik 3035
There is an Emacs package called ESS ("Emacs Speaks Statistics") which
8384 hornik 3036
provides a standard interface between statistical programs and statistical
3037
processes.  It is intended to provide assistance for interactive
6536 hornik 3038
statistical programming and data analysis.  Languages supported include: S
3039
dialects (S 3/4, S-PLUS 3.x/4.x/5.x, and R), LispStat dialects (XLispStat,
19445 hornik 3040
ViSta) and SAS.  Stata and SPSS dialect (SPSS, PSPP) support is being
3041
examined for possible future implementation
3930 hornik 3042
 
8384 hornik 3043
   ESS grew out of the need for bug fixes and extensions to S-mode 4.8
6536 hornik 3044
(which was a GNU Emacs interface to S/S-PLUS version 3 only).  The current
3045
set of developers desired support for XEmacs, R, S4, and MS Windows.  In
3046
addition, with new modes being developed for R, Stata, and SAS, it was felt
8384 hornik 3047
that a unifying interface and framework for the user interface would
3048
benefit both the user and the developer, by helping both groups conform to
3049
standard Emacs usage.  The end result is an increase in efficiency for
3050
statistical programming and data analysis, over the usual tools.
3930 hornik 3051
 
3052
   R support contains code for editing R source code (syntactic indentation
3053
and highlighting of source code, partial evaluations of code, loading and
3054
error-checking of code, and source code revision maintenance) and
6536 hornik 3055
documentation (syntactic indentation and highlighting of source code,
9442 hornik 3056
sending examples to running ESS process, and previewing), interacting with
6536 hornik 3057
an inferior R process from within Emacs (command-line editing, searchable
3058
command history, command-line completion of R object and file names, quick
3059
access to object and search lists, transcript recording, and an interface
3060
to the help system), and transcript manipulation (recording and saving
3061
transcript files, manipulating and editing saved transcripts, and
3062
re-evaluating commands from transcript files).
3930 hornik 3063
 
19445 hornik 3064
   The latest stable version of ESS are available via CRAN or the ESS web
26570 hornik 3065
page (http://ESS.R-project.org/).  The HTML version of the documentation
3066
can be found at `http://stat.ethz.ch/ESS/'.
3930 hornik 3067
 
3068
   ESS comes with detailed installation instructions.
3069
 
4074 hornik 3070
   For help with ESS, send email to <ESS-help@stat.ethz.ch>.
3071
 
3072
   Please send bug reports and suggestions on ESS to
3073
<ESS-bugs@stat.math.ethz.ch>.  The easiest way to do this from is within
3074
Emacs by typing `M-x ess-submit-bug-report' or using the [ESS] or [iESS]
3075
pulldown menus.
3076
 
5042 hornik 3077
6.2 Should I run R from within Emacs?
4035 hornik 3078
=====================================
3930 hornik 3079
 
26562 hornik 3080
Yes, _definitely_.  Inferior R mode provides a readline/history mechanism,
3081
object name completion, and syntax-based highlighting of the interaction
3082
buffer using Font Lock mode, as well as a very convenient interface to the
3083
R help system.
3930 hornik 3084
 
3085
   Of course, it also integrates nicely with the mechanisms for editing R
3086
source using Emacs.  One can write code in one Emacs buffer and send whole
3087
or parts of it for execution to R; this is helpful for both data analysis
3088
and programming.  One can also seamlessly integrate with a revision control
3089
system, in order to maintain a log of changes in your programs and data, as
3090
well as to allow for the retrieval of past versions of the code.
3091
 
3092
   In addition, it allows you to keep a record of your session, which can
3093
also be used for error recovery through the use of the transcript mode.
3094
 
3095
   To specify command line arguments for the inferior R process, use `C-u
11789 hornik 3096
M-x R' for starting R.
3930 hornik 3097
 
7026 hornik 3098
6.3 Debugging R from within Emacs
3099
=================================
3100
 
26562 hornik 3101
To debug R "from within Emacs", there are several possibilities.  To use
7160 hornik 3102
the Emacs GUD (Grand Unified Debugger) library with the recommended
8851 hornik 3103
debugger GDB, type `M-x gdb' and give the path to the R _binary_ as
19445 hornik 3104
argument.  At the `gdb' prompt, set `R_HOME' and other environment
3105
variables as needed (using e.g.  `set env R_HOME /path/to/R/', but see also
3106
below), and start the binary with the desired arguments (e.g., `run
25701 hornik 3107
--quiet').
7026 hornik 3108
 
8384 hornik 3109
   If you have ESS, you can do `C-u M-x R <RET> - d <SPC> g d b <RET>' to
3110
start an inferior R process with arguments `-d gdb'.
7026 hornik 3111
 
3112
   A third option is to start an inferior R process via ESS (`M-x R') and
8384 hornik 3113
then start GUD (`M-x gdb') giving the R binary (using its full path name)
3114
as the program to debug.  Use the program `ps' to find the process number
3115
of the currently running R process then use the `attach' command in gdb to
3116
attach it to that process.  One advantage of this method is that you have
3117
separate `*R*' and `*gud-gdb*' windows.  Within the `*R*' window you have
3118
all the ESS facilities, such as object-name completion, that we know and
3119
love.
7026 hornik 3120
 
3121
   When using GUD mode for debugging from within Emacs, you may find it
3122
most convenient to use the directory with your code in it as the current
3123
working directory and then make a symbolic link from that directory to the
7160 hornik 3124
R binary.  That way `.gdbinit' can stay in the directory with the code and
3125
be used to set up the environment and the search paths for the source, e.g.
3126
as follows:
7026 hornik 3127
 
3128
     set env R_HOME /opt/R
3129
     set env R_PAPERSIZE letter
3130
     set env R_PRINTCMD lpr
3131
     dir /opt/R/src/appl
3132
     dir /opt/R/src/main
3133
     dir /opt/R/src/nmath
3134
     dir /opt/R/src/unix
3135
 
11353 hornik 3136
7 R Miscellanea
4035 hornik 3137
***************
3930 hornik 3138
 
5042 hornik 3139
7.1 Why does R run out of memory?
4035 hornik 3140
=================================
3930 hornik 3141
 
26562 hornik 3142
Versions of R prior to 1.2.0 used a _static_ memory model.  At startup, R
3143
asked the operating system to reserve a fixed amount of memory for it.  The
3144
size of this chunk could not be changed subsequently.  Hence, it could
11789 hornik 3145
happen that not enough memory was allocated, e.g., when trying to read
3146
large data sets into R.  In such cases, it was necessary to restart R with
3147
more memory available, as controlled by the command line options `--nsize'
3148
and `--vsize'.
3930 hornik 3149
 
10237 hornik 3150
   R version 1.2.0 introduces a new "generational" garbage collector, which
11789 hornik 3151
will increase the memory available to R as needed.  Hence, user
3152
intervention is no longer necessary for ensuring that enough memory is
3153
available.
10237 hornik 3154
 
16676 hornik 3155
   The new garbage collector does not move objects in memory, meaning that
3156
it is possible for the free memory to become fragmented so that large
3157
objects cannot be allocated even when there is apparently enough memory for
3158
them.
3159
 
5042 hornik 3160
7.2 Why does sourcing a correct file fail?
4035 hornik 3161
==========================================
3930 hornik 3162
 
26562 hornik 3163
Versions of R prior to 1.2.1 may have had problems parsing files not ending
3164
in a newline.  Earlier R versions had a similar problem when reading in
3165
data files.  This should no longer happen.
3930 hornik 3166
 
5042 hornik 3167
7.3 How can I set components of a list to NULL?
4035 hornik 3168
===============================================
3930 hornik 3169
 
26562 hornik 3170
You can use
3930 hornik 3171
 
3172
     x[i] <- list(NULL)
3173
 
3174
to set component `i' of the list `x' to `NULL', similarly for named
3175
components.  Do not set `x[i]' or `x[[i]]' to `NULL', because this will
3176
remove the corresponding component from the list.
3177
 
3178
   For dropping the row names of a matrix `x', it may be easier to use
3179
`rownames(x) <- NULL', similarly for column names.
3180
 
5042 hornik 3181
7.4 How can I save my workspace?
4035 hornik 3182
================================
3930 hornik 3183
 
26562 hornik 3184
`save.image()' saves the objects in the user's `.GlobalEnv' to the file
3930 hornik 3185
`.RData' in the R startup directory.  (This is also what happens after
3186
`q("yes")'.)  Using `save.image(FILE)' one can save the image under a
3187
different name.
3188
 
5042 hornik 3189
7.5 How can I clean up my workspace?
4035 hornik 3190
====================================
3930 hornik 3191
 
26562 hornik 3192
To remove all objects in the currently active environment (typically
3930 hornik 3193
`.GlobalEnv'), you can do
3194
 
6098 pd 3195
     rm(list = ls(all = TRUE))
3930 hornik 3196
 
6098 pd 3197
(Without `all = TRUE', only the objects with names not starting with a `.'
3198
are removed.)
3199
 
5042 hornik 3200
7.6 How can I get eval() and D() to work?
4035 hornik 3201
=========================================
3930 hornik 3202
 
26562 hornik 3203
Strange things will happen if you use `eval(print(x), envir = e)' or
3930 hornik 3204
`D(x^2, "x")'.  The first one will either tell you that "`x'" is not found,
3205
or print the value of the wrong `x'.  The other one will likely return zero
3206
if `x' exists, and an error otherwise.
3207
 
3208
   This is because in both cases, the first argument is evaluated in the
3209
calling environment first.  The result (which should be an object of mode
8384 hornik 3210
`"expression"' or `"call"') is then evaluated or differentiated.  What you
3930 hornik 3211
(most likely) really want is obtained by "quoting" the first argument upon
3212
surrounding it with `expression()'.  For example,
3213
 
3214
     R> D(expression(x^2), "x")
3215
     2 * x
3216
 
3217
   Although this behavior may initially seem to be rather strange, is
3218
perfectly logical.  The "intuitive" behavior could easily be implemented,
3219
but problems would arise whenever the expression is contained in a
3220
variable, passed as a parameter, or is the result of a function call.
3221
Consider for instance the semantics in cases like
3222
 
3223
     D2 <- function(e, n) D(D(e, n), n)
3224
 
3225
or
3226
 
3227
     g <- function(y) eval(substitute(y), sys.frame(sys.parent(n = 2)))
3228
     g(a * b)
3229
 
8384 hornik 3230
   See the help page for `deriv()' for more examples.
3930 hornik 3231
 
5042 hornik 3232
7.7 Why do my matrices lose dimensions?
4035 hornik 3233
=======================================
3930 hornik 3234
 
26562 hornik 3235
When a matrix with a single row or column is created by a subscripting
3930 hornik 3236
operation, e.g., `row <- mat[2, ]', it is by default turned into a vector.
3237
In a similar way if an array with dimension, say, 2 x 3 x 1 x 4 is created
3238
by subscripting it will be coerced into a 2 x 3 x 4 array, losing the
3239
unnecessary dimension.  After much discussion this has been determined to
4035 hornik 3240
be a _feature_.
3930 hornik 3241
 
3242
   To prevent this happening, add the option `drop = FALSE' to the
8384 hornik 3243
subscripting.  For example,
3930 hornik 3244
 
3245
     rowmatrix <- mat[2, , drop = FALSE]  # creates a row matrix
3246
     colmatrix <- mat[, 2, drop = FALSE]  # creates a column matrix
3247
     a <- b[1, 1, 1, drop = FALSE]        # creates a 1 x 1 x 1 array
3248
 
3249
   The `drop = FALSE' option should be used defensively when programming.
3250
For example, the statement
3251
 
3252
     somerows <- mat[index, ]
3253
 
3254
will return a vector rather than a matrix if `index' happens to have length
3255
1, causing errors later in the code.  It should probably be rewritten as
3256
 
3257
     somerows <- mat[index, , drop = FALSE]
3258
 
5042 hornik 3259
7.8 How does autoloading work?
4035 hornik 3260
==============================
3930 hornik 3261
 
26562 hornik 3262
R has a special environment called `.AutoloadEnv'.  Using `autoload(NAME,
3263
PKG)', where NAME and PKG are strings giving the names of an object and the
3264
package containing it, stores some information in this environment.  When R
3265
tries to evaluate NAME, it loads the corresponding package PKG and
3266
reevaluates NAME in the new package's environment.
3930 hornik 3267
 
3268
   Using this mechanism makes R behave as if the package was loaded, but
3269
does not occupy memory (yet).
3270
 
3271
   See the help page for `autoload()' for a very nice example.
3272
 
5042 hornik 3273
7.9 How should I set options?
4035 hornik 3274
=============================
3930 hornik 3275
 
26562 hornik 3276
The function `options()' allows setting and examining a variety of global
3277
"options" which affect the way in which R computes and displays its
3930 hornik 3278
results.  The variable `.Options' holds the current values of these
3279
options, but should never directly be assigned to unless you want to drive
3280
yourself crazy--simply pretend that it is a "read-only" variable.
3281
 
3282
   For example, given
3283
 
3284
     test1 <- function(x = pi, dig = 3) {
3285
       oo <- options(digits = dig); on.exit(options(oo));
3286
       cat(.Options$digits, x, "\n")
3287
     }
3288
     test2 <- function(x = pi, dig = 3) {
3289
       .Options$digits <- dig
3290
       cat(.Options$digits, x, "\n")
3291
     }
3292
 
3293
we obtain:
3294
 
3295
     R> test1()
3296
     3 3.14
3297
     R> test2()
3298
     3 3.141593
3299
 
4035 hornik 3300
   What is really used is the _global_ value of `.Options', and using
3930 hornik 3301
`options(OPT = VAL)' correctly updates it.  Local copies of `.Options',
3302
either in `.GlobalEnv' or in a function environment (frame), are just
3303
silently disregarded.
3304
 
5042 hornik 3305
7.10 How do file names work in Windows?
4035 hornik 3306
=======================================
3930 hornik 3307
 
26562 hornik 3308
As R uses C-style string handling, `\' is treated as an escape character,
3309
so that for example one can enter a newline as `\n'.  When you really need
3310
a `\', you have to escape it with another `\'.
3930 hornik 3311
 
3312
   Thus, in filenames use something like `"c:\\data\\money.dat"'.  You can
6404 hornik 3313
also replace `\' by `/' (`"c:/data/money.dat"').
3930 hornik 3314
 
5042 hornik 3315
7.11 Why does plotting give a color allocation error?
4035 hornik 3316
=====================================================
3930 hornik 3317
 
26562 hornik 3318
Sometimes plotting, e.g., when running `demo("image")', results in "Error:
3319
color allocation error".  This is an X problem, and only indirectly related
3320
to R.  It occurs when applications started prior to R have used all the
3321
available colors.  (How many colors are available depends on the X
3930 hornik 3322
configuration; sometimes only 256 colors can be used.)
3323
 
3324
   One application which is notorious for "eating" colors is Netscape.  If
3325
the problem occurs when Netscape is running, try (re)starting it with
3326
either the `-no-install' (to use the default colormap) or the `-install'
3327
(to install a private colormap) option.
3328
 
9442 hornik 3329
   You could also set the `colortype' of `X11()' to `"pseudo.cube"' rather
3330
than the default `"pseudo"'.  See the help page for `X11()' for more
5073 hornik 3331
information.
3332
 
15255 hornik 3333
7.12 How do I convert factors to numeric?
8384 hornik 3334
=========================================
3335
 
26562 hornik 3336
It may happen that when reading numeric data into R (usually, when reading
3337
in a file), they come in as factors.  If `f' is such a factor object, you
3338
can use
8384 hornik 3339
 
3340
     as.numeric(as.character(f))
3341
 
3342
to get the numbers back.  More efficient, but harder to remember, is
3343
 
3344
     as.numeric(levels(f))[as.integer(f)]
3345
 
25947 hornik 3346
   In any case, do not call `as.numeric()' or their likes directly for the
3347
task at hand (as `as.numeric()' or `unclass()' give the internal codes).
8384 hornik 3348
 
15255 hornik 3349
7.13 Are Trellis displays implemented in R?
8649 hornik 3350
===========================================
3351
 
26562 hornik 3352
The recommended package *lattice* (which is based on another recommended
19445 hornik 3353
package, *grid*) provides graphical functionality that is compatible with
3354
most Trellis commands.
8649 hornik 3355
 
14275 hornik 3356
   You could also look at `coplot()' and `dotchart()' which might do at
3357
least some of what you want.  Note also that the R version of `pairs()' is
3358
fairly general and provides most of the functionality of `splom()', and
3359
that R's default plot method has an argument `asp' allowing to specify (and
3360
fix against device resizing) the aspect ratio of the plot.
3361
 
13660 hornik 3362
   (Because the word "Trellis" has been claimed as a trademark we do not
18197 hornik 3363
use it in R.  The name "lattice" has been chosen for the R equivalent.)
8649 hornik 3364
 
15255 hornik 3365
7.14 What are the enclosing and parent environments?
9331 hornik 3366
====================================================
3367
 
26562 hornik 3368
Inside a function you may want to access variables in two additional
9331 hornik 3369
environments: the one that the function was defined in ("enclosing"), and
14729 hornik 3370
the one it was invoked in ("parent").
9331 hornik 3371
 
3372
   If you create a function at the command line or load it in a package its
3373
enclosing environment is the global workspace.  If you define a function
3374
`f()' inside another function `g()' its enclosing environment is the
3375
environment inside `g()'.  The enclosing environment for a function is
3376
fixed when the function is created.  You can find out the enclosing
3377
environment for a function `f()' using `environment(f)'.
3378
 
3379
   The "parent" environment, on the other hand, is defined when you invoke
3380
a function.  If you invoke `lm()' at the command line its parent
3381
environment is the global workspace, if you invoke it inside a function
3382
`f()' then its parent environment is the environment inside `f()'.  You can
3383
find out the parent environment for an invocation of a function by using
3384
`parent.frame()' or `sys.frame(sys.parent())'.
3385
 
3386
   So for most user-visible functions the enclosing environment will be the
3387
global workspace, since that is where most functions are defined.  The
3388
parent environment will be wherever the function happens to be called from.
3389
If a function `f()' is defined inside another function `g()' it will
3390
probably be used inside `g()' as well, so its parent environment and
3391
enclosing environment will probably be the same.
3392
 
3393
   Parent environments are important because things like model formulas
3394
need to be evaluated in the environment the function was called from, since
3395
that's where all the variables will be available.  This relies on the
3396
parent environment being potentially different with each invocation.
3397
 
3398
   Enclosing environments are important because a function can use
3399
variables in the enclosing environment to share information with other
3400
functions or with other invocations of itself (see the section on lexical
3401
scoping).  This relies on the enclosing environment being the same each
3402
time the function is invoked.
3403
 
3404
   Scoping _is_ hard.  Looking at examples helps.  It is particularly
3405
instructive to look at examples that work differently in R and S and try to
3406
see why they differ.  One way to describe the scoping differences between R
3407
and S is to say that in S the enclosing environment is _always_ the global
3408
workspace, but in R the enclosing environment is wherever the function was
3409
created.
3410
 
15255 hornik 3411
7.15 How can I substitute into a plot label?
10519 hornik 3412
============================================
3413
 
26562 hornik 3414
Often, it is desired to use the value of an R object in a plot label, e.g.,
3415
a title.  This is easily accomplished using `paste()' if the label is a
3416
simple character string, but not always obvious in case the label is an
10519 hornik 3417
expression (for refined mathematical annotation).  In such a case, either
3418
use `parse()' on your pasted character string or use `substitute()' on an
3419
expression.  For example, if `ahat' is an estimator of your parameter a of
3420
interest, use
3421
 
3422
     title(substitute(hat(a) == ahat, list(ahat = ahat)))
3423
 
3424
(note that it is `==' and not `=').  There are more worked examples in the
3425
mailing list achives.
3426
 
15255 hornik 3427
7.16 What are valid names?
11765 hornik 3428
==========================
3429
 
26562 hornik 3430
When creating data frames using `data.frame()' or `read.table()', R by
11765 hornik 3431
default ensures that the variable names are syntactically valid.  (The
3432
argument `check.names' to these functions controls whether variable names
14729 hornik 3433
are checked and adjusted by `make.names()' if needed.)
11765 hornik 3434
 
3435
   To understand what names are "valid", one needs to take into account
3436
that the term "name" is used in several different (but related) ways in the
3437
language:
3438
 
3439
  1. A _syntactic name_ is a string the parser interprets as this type of
27251 hornik 3440
     expression.  It consists of letters, numbers, and the dot and (for
3441
     version of R at least 1.9.0) underscore characters, and starts with
3442
     either a letter or a dot not followed by a number.  Reserved words are
3443
     not syntactic names.
11765 hornik 3444
 
3445
  2. An _object name_ is a string associated with an object that is
3446
     assigned in an expression either by having the object name on the left
14729 hornik 3447
     of an assignment operation or as an argument to the `assign()'
3448
     function.  It is usually a syntactic name as well, but can be any
3449
     non-empty string if it is quoted (and it is always quoted in the call
3450
     to `assign()').
11765 hornik 3451
 
3452
  3. An _argument name_ is what appears to the left of the equals sign when
3453
     supplying an argument in a function call (for example, `f(trim=.5)').
3454
     Argument names are also usually syntactic names, but again can be
3455
     anything if they are quoted.
3456
 
3457
  4. An _element name_ is a string that identifies a piece of an object (a
3458
     component of a list, for example.)  When it is used on the right of
3459
     the `$' operator, it must be a syntactic name, or quoted.  Otherwise,
3460
     element names can be any strings.  (When an object is used as a
14729 hornik 3461
     database, as in a call to `eval()' or `attach()', the element names
3462
     become object names.)
11765 hornik 3463
 
3464
  5. Finally, a _file name_ is a string identifying a file in the operating
3465
     system for reading, writing, etc.  It really has nothing much to do
3466
     with names in the language, but it is traditional to call these
3467
     strings file "names".
3468
 
15255 hornik 3469
7.17 Are GAMs implemented in R?
12026 hornik 3470
===============================
3471
 
26562 hornik 3472
There is a `gam()' function for Generalized Additive Models in package
12026 hornik 3473
*mgcv*, but it is not an exact clone of what is described in the White Book
3474
(no `lo()' for example).  Package *gss* can fit spline-based GAMs too.  And
3475
if you can accept regression splines you can use `glm()'.  For gaussian
13737 hornik 3476
GAMs you can use `bruto()' from package *mda*.
12026 hornik 3477
 
15255 hornik 3478
7.18 Why is the output not printed when I source() a file?
13127 hornik 3479
==========================================================
3480
 
26562 hornik 3481
Most R commands do not generate any output. The command
13127 hornik 3482
 
3483
     1+1
3484
 
3485
computes the value 2 and returns it; the command
3486
 
3487
     summary(glm(y~x+z, family=binomial))
3488
 
3489
fits a logistic regression model, computes some summary information and
3490
returns an object of class `"summary.glm"' (*note How should I write
3491
summary methods?::).
3492
 
14729 hornik 3493
   If you type `1+1' or `summary(glm(y~x+z, family=binomial))' at the
13127 hornik 3494
command line the returned value is automatically printed (unless it is
3495
`invisible()'), but in other circumstances, such as in a `source()'d file
3496
or inside a function it isn't printed unless you specifically print it.
3497
 
3498
   To print the value use
3499
 
3500
     print(1+1)
3501
 
3502
or
3503
 
3504
     print(summary(glm(y~x+z, family=binomial)))
3505
 
3506
instead, or use `source(FILE, echo=TRUE)'.
3507
 
15255 hornik 3508
7.19 Why does outer() behave strangely with my function?
14075 hornik 3509
========================================================
3510
 
26562 hornik 3511
As the help for `outer()' indicates, it does not work on arbitrary
14075 hornik 3512
functions the way the `apply()' family does.  It requires functions that
3513
are vectorized to work elementwise on arrays.  As you can see by looking at
3514
the code, `outer(x, y, FUN)' creates two large vectors containing every
3515
possible combination of elements of `x' and `y' and then passes this to
3516
`FUN' all at once.  Your function probably cannot handle two large vectors
3517
as parameters.
3518
 
15168 pd 3519
   If you have a function that cannot handle two vectors but can handle two
3520
scalars, then you can still use `outer()' but you will need to wrap your
3521
function up first, to simulate vectorized behavior.  Suppose your function
3522
is
3523
 
3524
     foo <- function(x, y, happy) {
3525
       stopifnot(length(x) == 1, length(y) == 1) # scalars only!
3526
       (x + y) * happy
3527
     }
3528
 
3529
If you define the general function
3530
 
3531
     wrapper <- function(x, y, my.fun, ...) {
24597 hornik 3532
       sapply(seq(along = x), FUN = function(i) my.fun(x[i], y[i], ...))
15168 pd 3533
     }
3534
 
3535
then you can use `outer()' by writing, e.g.,
3536
 
3537
     outer(1:4, 1:2, FUN = wrapper, my.fun = foo, happy = 10)
3538
 
16521 hornik 3539
7.20 Why does the output from anova() depend on the order of factors in the model?
3540
==================================================================================
3541
 
26562 hornik 3542
In a model such as `~A+B+A:B', R will report the difference in sums of
16521 hornik 3543
squares between the models `~1', `~A', `~A+B' and `~A+B+A:B'.  If the model
3544
were `~B+A+A:B', R would report differences between `~1', `~B', `~A+B', and
3545
`~A+B+A:B' . In the first case the sum of squares for `A' is comparing `~1'
3546
and `~A', in the second case it is comparing `~B' and `~B+A'.  In a
3547
non-orthogonal design (i.e., most unbalanced designs) these comparisons are
3548
(conceptually and numerically) different.
3549
 
3550
   Some packages report instead the sums of squares based on comparing the
3551
full model to the models with each factor removed one at a time (the famous
3552
`Type III sums of squares' from SAS, for example).  These do not depend on
3553
the order of factors in the model.  The question of which set of sums of
26253 hornik 3554
squares is the Right Thing provokes low-level holy wars on R-help from time
16521 hornik 3555
to time.
3556
 
3557
   There is no need to be agitated about the particular sums of squares
3558
that R reports.  You can compute your favorite sums of squares quite
19445 hornik 3559
easily.  Any two models can be compared with `anova(MODEL1, MODEL2)', and
3560
`drop1(MODEL1)' will show the sums of squares resulting from dropping
16521 hornik 3561
single terms.
3562
 
20429 hornik 3563
7.21 How do I produce PNG graphics in batch mode?
3564
=================================================
3565
 
26562 hornik 3566
Under Unix, the `png()' device uses the X11 driver, which is a problem in
3567
batch mode or for remote operation.  If you have Ghostscript you can use
20429 hornik 3568
`bitmap()', which produces a PostScript file then converts it to any bitmap
3569
format supported by ghostscript.  On some installations this produces ugly
3570
output, on others it is perfectly satisfactory.  In theory one could also
3571
use Xvfb, which provides an X server with no display.
3572
 
20581 hornik 3573
7.22 How can I get command line editing to work?
3574
================================================
3575
 
26562 hornik 3576
The Unix command-line interface to R can only provide the inbuilt command
3577
line editor which allows recall, editing and re-submission of prior
20581 hornik 3578
commands provided that the GNU readline library is available at the time R
3579
is configured for compilation.  Note that the `development' version of
3580
readline including the appropriate headers is needed: users of Linux binary
3581
distributions will need to install packages such as `libreadline-dev'
3582
(Debian) or `readline-devel' (Red Hat).
3583
 
21306 hornik 3584
7.23 How can I turn a string into a variable?
3585
=============================================
3586
 
26562 hornik 3587
If you have
21306 hornik 3588
 
3589
     varname <- c("a", "b", "d")
3590
 
3591
you can do
3592
 
3593
     get(varname[1]) + 2
3594
 
3595
for
3596
 
3597
     a + 2
3598
 
3599
or
3600
 
3601
     assign(varname[1], 2 + 2)
3602
 
3603
for
3604
 
3605
     a <- 2 + 2
3606
 
3607
or
3608
 
3609
     eval(substitute(lm(y ~ x + variable),
3610
                     list(variable = as.name(varname[1]))
3611
 
3612
for
3613
 
3614
     lm(y ~ x + a)
3615
 
3616
   At least in the first two cases it is often easier to just use a list,
3617
and then you can easily index it by name
3618
 
3619
     vars <- list(a = 1:10, b = rnorm(100), d = LETTERS)
3620
     vars[["a"]]
3621
 
3622
without any of this messing about.
3623
 
24270 hornik 3624
7.24 Why do lattice/trellis graphics not work?
3625
==============================================
3626
 
26562 hornik 3627
The most likely reason is that you forgot to tell R to display the graph.
3628
Lattice functions such as `xyplot()' create a graph object, but do not
3629
display it (the same is true of Trellis graphics in S-PLUS).  The `print()'
3630
method for the graph object produces the actual display.  When you use
3631
these functions interactively at the command line, the result is
24270 hornik 3632
automatically printed, but in `source()' or inside your own functions you
3633
will need an explicit `print()' statement.
3634
 
24411 hornik 3635
7.25 How can I sort the rows of a data frame?
3636
=============================================
3637
 
26562 hornik 3638
To sort the rows within a data frame, with respect to the values in one or
3639
more of the columns, simply use `order()'.
24411 hornik 3640
 
4035 hornik 3641
8 R Programming
3642
***************
3930 hornik 3643
 
5042 hornik 3644
8.1 How should I write summary methods?
4035 hornik 3645
=======================================
3930 hornik 3646
 
26562 hornik 3647
Suppose you want to provide a summary method for class `"foo"'.  Then
3930 hornik 3648
`summary.foo()' should not print anything, but return an object of class
8384 hornik 3649
`"summary.foo"', _and_ you should write a method `print.summary.foo()'
3650
which nicely prints the summary information and invisibly returns its
3651
object.  This approach is preferred over having `summary.foo()' print
3652
summary information and return something useful, as sometimes you need to
3653
grab something computed by `summary()' inside a function or similar.  In
3654
such cases you don't want anything printed.
3930 hornik 3655
 
5042 hornik 3656
8.2 How can I debug dynamically loaded code?
4035 hornik 3657
============================================
3930 hornik 3658
 
26562 hornik 3659
Roughly speaking, you need to start R inside the debugger, load the code,
3660
send an interrupt, and then set the required breakpoints.
8384 hornik 3661
 
8277 hornik 3662
   See section "Finding entry points in dynamically loaded code" in
8384 hornik 3663
`Writing R Extensions'.  This manual is included in the R distribution,
3664
*note What documentation exists for R?::.
3930 hornik 3665
 
5042 hornik 3666
8.3 How can I inspect R objects when debugging?
4035 hornik 3667
===============================================
3930 hornik 3668
 
26562 hornik 3669
The most convenient way is to call `R_PV' from the symbolic debugger.
8384 hornik 3670
 
8277 hornik 3671
   See section "Inspecting R objects when debugging" in `Writing R
3672
Extensions'.
3930 hornik 3673
 
10825 hornik 3674
8.4 How can I change compilation flags?
3675
=======================================
3676
 
26562 hornik 3677
Suppose you have C code file for dynloading into R, but you want to use `R
3678
CMD SHLIB' with compilation flags other than the default ones (which were
3679
determined when R was built).  You could change the file
10825 hornik 3680
``R_HOME'/etc/Makeconf' to reflect your preferences.  If you are a Bourne
3681
shell user, you can also pass the desired flags to Make (which is used for
3682
controlling compilation) via the Make variable `MAKEFLAGS', as in
3683
 
3684
     MAKEFLAGS="CFLAGS=-O3" R CMD SHLIB *.c
3685
 
4035 hornik 3686
9 R Bugs
3687
********
3930 hornik 3688
 
5042 hornik 3689
9.1 What is a bug?
4035 hornik 3690
==================
3930 hornik 3691
 
26562 hornik 3692
If R executes an illegal instruction, or dies with an operating system
3930 hornik 3693
error message that indicates a problem in the program (as opposed to
3694
something like "disk full"), then it is certainly a bug.  If you call
7160 hornik 3695
`.C()', `.Fortran()', `.External()' or `.Call()' (or `.Internal()')
3696
yourself (or in a function you wrote), you can always crash R by using
3697
wrong argument types (modes).  This is not a bug.
3930 hornik 3698
 
3699
   Taking forever to complete a command can be a bug, but you must make
3700
certain that it was really R's fault.  Some commands simply take a long
4035 hornik 3701
time.  If the input was such that you _know_ it should have been processed
3930 hornik 3702
quickly, report a bug.  If you don't know whether the command should take a
3703
long time, find out by looking in the manual or by asking for assistance.
3704
 
3705
   If a command you are familiar with causes an R error message in a case
8384 hornik 3706
where its usual definition ought to be reasonable, it is probably a bug.
3707
If a command does the wrong thing, that is a bug.  But be sure you know for
3930 hornik 3708
certain what it ought to have done.  If you aren't familiar with the
3709
command, or don't know for certain how the command is supposed to work,
3710
then it might actually be working right.  Rather than jumping to
3711
conclusions, show the problem to someone who knows for certain.
3712
 
3713
   Finally, a command's intended definition may not be best for statistical
3714
analysis.  This is a very important sort of problem, but it is also a
3715
matter of judgment.  Also, it is easy to come to such a conclusion out of
3716
ignorance of some of the existing features.  It is probably best not to
3717
complain about such a problem until you have checked the documentation in
3718
the usual ways, feel confident that you understand it, and know for certain
3719
that what you want is not available.  If you are not sure what the command
3720
is supposed to do after a careful reading of the manual this indicates a
3721
bug in the manual.  The manual's job is to make everything clear.  It is
3722
just as important to report documentation bugs as program bugs.  However,
3723
we know that the introductory documentation is seriously inadequate, so you
3724
don't need to report this.
3725
 
3726
   If the online argument list of a function disagrees with the manual, one
3727
of them must be wrong, so report the bug.
3728
 
5042 hornik 3729
9.2 How to report a bug
4035 hornik 3730
=======================
3930 hornik 3731
 
26562 hornik 3732
When you decide that there is a bug, it is important to report it and to
3930 hornik 3733
report it in a way which is useful.  What is most useful is an exact
3734
description of what commands you type, starting with the shell command to
3735
run R, until the problem happens.  Always include the version of R,
3736
machine, and operating system that you are using; type `version' in R to
3737
print this.
3738
 
4035 hornik 3739
   The most important principle in reporting a bug is to report _facts_,
3930 hornik 3740
not hypotheses or categorizations.  It is always easier to report the
3741
facts, but people seem to prefer to strain to posit explanations and report
3742
them instead.  If the explanations are based on guesses about how R is
5598 hornik 3743
implemented, they will be useless; others will have to try to figure out
3744
what the facts must have been to lead to such speculations.  Sometimes this
3745
is impossible.  But in any case, it is unnecessary work for the ones trying
3746
to fix the problem.
3930 hornik 3747
 
3748
   For example, suppose that on a data set which you know to be quite large
3749
the command
3750
 
3751
     R> data.frame(x, y, z, monday, tuesday)
3752
 
8384 hornik 3753
never returns.  Do not report that `data.frame()' fails for large data
3754
sets.  Perhaps it fails when a variable name is a day of the week.  If this
3755
is so then when others got your report they would try out the
3756
`data.frame()' command on a large data set, probably with no day of the
3757
week variable name, and not see any problem.  There is no way in the world
3758
that others could guess that they should try a day of the week variable
3759
name.
3930 hornik 3760
 
3761
   Or perhaps the command fails because the last command you used was a
3762
method for `"["()' that had a bug causing R's internal data structures to
3763
be corrupted and making the `data.frame()' command fail from then on.  This
5598 hornik 3764
is why others need to know what other commands you have typed (or read from
3930 hornik 3765
your startup file).
3766
 
3767
   It is very useful to try and find simple examples that produce
3768
apparently the same bug, and somewhat useful to find simple examples that
3769
might be expected to produce the bug but actually do not.  If you want to
8384 hornik 3770
debug the problem and find exactly what caused it, that is wonderful.  You
3930 hornik 3771
should still report the facts as well as any explanations or solutions.
6404 hornik 3772
Please include an example that reproduces the problem, preferably the
3773
simplest one you have found.
3930 hornik 3774
 
8384 hornik 3775
   Invoking R with the `--vanilla' option may help in isolating a bug.
3776
This ensures that the site profile and saved data files are not read.
3930 hornik 3777
 
3778
   On Unix systems a bug report can be generated using the function
8384 hornik 3779
`bug.report()'.  This automatically includes the version information and
3930 hornik 3780
sends the bug to the correct address.  Alternatively the bug report can be
26253 hornik 3781
emailed to <R-bugs@R-project.org> or submitted to the Web page at
3782
`http://bugs.R-project.org/'.
3930 hornik 3783
 
4074 hornik 3784
   Bug reports on contributed packages should perhaps be sent to the
26253 hornik 3785
package maintainer rather than to R-bugs.
4074 hornik 3786
 
4035 hornik 3787
10 Acknowledgments
3788
******************
3930 hornik 3789
 
26562 hornik 3790
Of course, many many thanks to Robert and Ross for the R system, and to the
3791
package writers and porters for adding to it.
3930 hornik 3792
 
15168 pd 3793
   Special thanks go to Doug Bates, Peter Dalgaard, Paul Gilbert, Stefano
3794
Iacus, Fritz Leisch, Jim Lindsey, Thomas Lumley, Martin Maechler, Brian D.
3795
Ripley, Anthony Rossini, and Andreas Weingessel for their comments which
3796
helped me improve this FAQ.
3930 hornik 3797
 
3798
   More to some soon ...
5316 hornik 3799