The R Project SVN R

Rev

Rev 6410 | Rev 6543 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6410 Rev 6536
Line 1... Line 1...
1
R FAQ
1
R FAQ
2
Frequently Asked Questions on R
2
Frequently Asked Questions on R
3
Version 0.65-11, 1999/11/10
3
Version 0.65-12, 1999/11/15
4
Kurt Hornik
4
Kurt Hornik
5
 
5
 
6
 
6
 
7
Table of Contents
7
Table of Contents
8
*****************
8
*****************
Line 163... Line 163...
163
resulting language is very similar in appearance to S, the underlying
163
resulting language is very similar in appearance to S, the underlying
164
implementation and semantics are derived from Scheme.  *Note What are the
164
implementation and semantics are derived from Scheme.  *Note What are the
165
differences between R and S?::, for a discussion of the differences between
165
differences between R and S?::, for a discussion of the differences between
166
R and S.
166
R and S.
167
 
167
 
168
   R was initially written by Ross Ihaka <ihaka@stat.auckland.ac.nz> and
168
   R was initially written by Ross Ihaka <Ross.Ihaka@r-project.org> and
169
Robert Gentleman <rgentlem@stat.auckland.ac.nz>, who are Senior Lecturers
169
Robert Gentleman <Robert.Gentleman@r-project.org>, who are Senior Lecturers
170
at the Department of Statistics of the University of Auckland in Auckland,
170
at the Department of Statistics of the University of Auckland in Auckland,
171
New Zealand.  In addition, a large group of individuals has contributed to
171
New Zealand.  In addition, a large group of individuals has contributed to
172
R by sending code and bug reports.
172
R by sending code and bug reports.
173
 
173
 
174
   Since mid-1997 there has been a core group (the "R Core Team") who can
174
   Since mid-1997 there has been a core group (the "R Core Team") who can
Line 277... Line 277...
277
   The `bin/windows/windows-NT' directory of a CRAN site contains the
277
   The `bin/windows/windows-NT' directory of a CRAN site contains the
278
latest binary distributions of R for 32 bit versions of MS Windows (i.e.,
278
latest binary distributions of R for 32 bit versions of MS Windows (i.e.,
279
95, 98 or NT), as well as binary distributions for a large number of add-on
279
95, 98 or NT), as well as binary distributions for a large number of add-on
280
packages from CRAN.  The Windows version of R was created by Robert
280
packages from CRAN.  The Windows version of R was created by Robert
281
Gentleman, and is now being developed and maintained by Guido Masarotto
281
Gentleman, and is now being developed and maintained by Guido Masarotto
282
<guido@sirio.stat.unipd.it> and Brian D. Ripley <ripley@stats.ox.ac.uk>.
282
<Guido.Masarotto@r-project.org> and Brian D. Ripley
-
 
283
<Brian.Ripley@r-project.org>.
283
 
284
 
284
   For most installations the installer `rwinst.exe' will be the easiest
285
   For most installations the installer `rwinst.exe' will be the easiest
285
tool to use.
286
tool to use.
286
 
287
 
287
   See the R Windows FAQ (http://www.stats.ox.ac.uk/pub/R/rw-FAQ.html) for
288
   See the R Windows FAQ (http://www.stats.ox.ac.uk/pub/R/rw-FAQ.html) for
Line 373... Line 374...
373
Graphical Statistics_, *5*, 299-314.
374
Graphical Statistics_, *5*, 299-314.
374
 
375
 
375
2.9 What mailing lists exist for R?
376
2.9 What mailing lists exist for R?
376
===================================
377
===================================
377
 
378
 
378
   Thanks to Martin Maechler <maechler@stat.math.ethz.ch>, there are three
379
   Thanks to Martin Maechler <Martin.Maechler@r-project.org>, there are
379
mailing lists devoted to R.
380
three mailing lists devoted to R.
380
 
381
 
381
`r-announce'
382
`r-announce'
382
     This list is for announcements about the development of R and the
383
     This list is for announcements about the development of R and the
383
     availability of new code.
384
     availability of new code.
384
 
385
 
Line 395... Line 396...
395
     for the posting of nice examples and benchmarks.
396
     for the posting of nice examples and benchmarks.
396
 
397
 
397
Note that the r-announce list is gatewayed into r-help, so you don't need
398
Note that the r-announce list is gatewayed into r-help, so you don't need
398
to subscribe to both of them.
399
to subscribe to both of them.
399
 
400
 
400
   Send email to <r-help@stat.math.ethz.ch> to reach everyone on the r-help
401
   Send email to <r-help@lists.r-project.org> to reach everyone on the
401
mailing list.  To subscribe (or unsubscribe) to this list send `subscribe'
402
r-help mailing list.  To subscribe (or unsubscribe) to this list send
402
(or `unsubscribe') in the BODY of the message (not in the subject!)  to
403
`subscribe' (or `unsubscribe') in the BODY of the message (not in the
403
<r-help-request@stat.math.ethz.ch>.  Information about the list can be
404
subject!)  to <r-help-request@lists.r-project.org>.  Information about the
404
obtained by sending an email with `info' as its contents to
405
list can be obtained by sending an email with `info' as its contents to
405
<r-help-request@stat.math.ethz.ch>.
406
<r-help-request@lists.r-project.org>.
406
 
407
 
407
   Subscription and posting to the other lists is done analogously, with
408
   Subscription and posting to the other lists is done analogously, with
408
`r-help' replaced by `r-announce' and `r-devel', respectively.
409
`r-help' replaced by `r-announce' and `r-devel', respectively.
409
 
410
 
410
   It is recommended that you send mail to r-help rather than only to the R
411
   It is recommended that you send mail to r-help rather than only to the R
Line 420... Line 421...
420
   Archives of the above three mailing lists are made available on the net
421
   Archives of the above three mailing lists are made available on the net
421
in a monthly schedule via the `doc/mail/mail.html' file in CRAN.  An HTML
422
in a monthly schedule via the `doc/mail/mail.html' file in CRAN.  An HTML
422
archive of the lists are available via
423
archive of the lists are available via
423
`http://www.ens.gu.edu.au/robertk/R/'.
424
`http://www.ens.gu.edu.au/robertk/R/'.
424
 
425
 
425
   The R Core Team can be reached at <r-core@stat.math.ethz.ch> for
426
   The R Core Team can be reached at <r-core@lists.r-project.org> for
426
comments and reports.
427
comments and reports.
427
 
428
 
428
2.10 What is CRAN?
429
2.10 What is CRAN?
429
==================
430
==================
430
 
431
 
Line 833... Line 834...
833
 
834
 
834
   * In S, the index variable in a `for()' loop is local to the inside of
835
   * In S, the index variable in a `for()' loop is local to the inside of
835
     the loop.  In R it is local to the environment where the `for()'
836
     the loop.  In R it is local to the environment where the `for()'
836
     statement is executed.
837
     statement is executed.
837
 
838
 
-
 
839
   * In S, `tapply(simplify=TRUE)' returns a vector where R returns a
-
 
840
     one-dimensional array (which can have named dimnames).
-
 
841
 
838
 
842
 
839
   There are also differences which are not intentional, and result from
843
   There are also differences which are not intentional, and result from
840
missing or incorrect code in R.  The developers would appreciate hearing
844
missing or incorrect code in R.  The developers would appreciate hearing
841
about any deficiencies you may find (in a written report fully documenting
845
about any deficiencies you may find (in a written report fully documenting
842
the difference as you see it).  Of course, it would be useful if you were
846
the difference as you see it).  Of course, it would be useful if you were
Line 1205... Line 1209...
1205
 
1209
 
1206
     $ R INSTALL -l LIB PKGDIR_1 ... PKGDIR_N
1210
     $ R INSTALL -l LIB PKGDIR_1 ... PKGDIR_N
1207
 
1211
 
1208
where LIB gives the path to the library tree to install to.
1212
where LIB gives the path to the library tree to install to.
1209
 
1213
 
1210
   As of R version 0.65.1, the need for explicit unpacking for installing
1214
   As of R version 0.65.1, you no longer need to explicitly unpack for
1211
will be removed.
1215
installing; i.e., you can do `R INSTALL /path/to/pkg_ver.tar.gz'.
1212
 
1216
 
1213
   You can use several library trees of add-on packages.  The easiest way
1217
   You can use several library trees of add-on packages.  The easiest way
1214
to tell R to use these is via the environment variable `R_LIBS' which
1218
to tell R to use these is via the environment variable `R_LIBS' which
1215
should be a colon-separated list of directories at which R library trees
1219
should be a colon-separated list of directories at which R library trees
1216
are rooted.  You do not have to specify the default tree in `R_LIBS'.
1220
are rooted.  You do not have to specify the default tree in `R_LIBS'.
1217
E.g., to use a private tree in `$HOME/lib/R' and a public site-wide tree in
1221
E.g., to use a private tree in `$HOME/lib/R' and a public site-wide tree in
1218
`/usr/local/lib/R/site', put
1222
`/usr/local/lib/R/site', put
1219
 
1223
 
1220
     R_LIBS="$HOME/lib/R:/usr/local/lib/R/site"; export R_LIBS
1224
     R_LIBS="$HOME/lib/R:/usr/local/lib/R/site"; export R_LIBS
1221
 
1225
 
1222
into your (Bourne) shell profile.
1226
into your (Bourne) shell profile or your `~/.Renviron' file.
1223
 
1227
 
1224
5.3 How can add-on packages be used?
1228
5.3 How can add-on packages be used?
1225
====================================
1229
====================================
1226
 
1230
 
1227
   To find out which additional packages are available on your system, type
1231
   To find out which additional packages are available on your system, type
Line 1338... Line 1342...
1338
 
1342
 
1339
   The `data' subdirectory is for additional data files the package makes
1343
   The `data' subdirectory is for additional data files the package makes
1340
available for loading using `data()'.  Currently, data files can have one
1344
available for loading using `data()'.  Currently, data files can have one
1341
of three types as indicated by their extension:  plain R code (`.R' or
1345
of three types as indicated by their extension:  plain R code (`.R' or
1342
`.r'), tables (`.tab', `.txt', or `.csv'), or `save()' images (`.RData' or
1346
`.r'), tables (`.tab', `.txt', or `.csv'), or `save()' images (`.RData' or
-
 
1347
`.rda').  The subdirectory should contain a `00Index' file that describes
1343
`.rda').
1348
the datasets available.
1344
 
1349
 
1345
   The contents of the `inst' subdirectory will be copied recursively to
1350
   The contents of the `inst' subdirectory will be copied recursively to
1346
the installation directory.
1351
the installation directory.
1347
 
1352
 
1348
   Finally, `exec' could contain additional executables the package needs,
1353
   Finally, `exec' could contain additional executables the package needs,
1349
typically Shell or Perl scripts.  This mechanism is currently not used by
1354
typically Shell or Perl scripts.  This mechanism is currently not used by
1350
any package, and still experimental.
1355
any package, and still experimental.
1351
 
1356
 
1352
   You can also provide shell scripts `configure' and `cleanup' for
1357
   You can also provide (Bourne) shell scripts `configure' and `cleanup'
1353
configuration before installation (such as checking for additional software
1358
for configuration before installation (such as checking for additional
1354
that might be needed by the package), and removing the files created in
1359
software that might be needed by the package), and removing the files
1355
this process.  See the add-on package *e1071* on CRAN for an example of
1360
created in this process.  See the add-on package *e1071* on CRAN for an
1356
this mechanism.
1361
example of this mechanism.
1357
 
1362
 
1358
   See the documentation for `library()' for more information.
1363
   See the documentation for `library()' for more information.
1359
 
1364
 
1360
   The web page `http://www.biostat.washington.edu/~thomas/Rlib.html'
1365
   The web page `http://www.biostat.washington.edu/~thomas/Rlib.html'
1361
maintained by Thomas Lumley provides information on porting S packages to R.
1366
maintained by Thomas Lumley provides information on porting S packages to R.
Line 1367... Line 1372...
1367
 
1372
 
1368
   R is currently still in alpha (or pre-alpha) state, so simply using it
1373
   R is currently still in alpha (or pre-alpha) state, so simply using it
1369
and communicating problems is certainly of great value.
1374
and communicating problems is certainly of great value.
1370
 
1375
 
1371
   One place where functionality is still missing is the modeling software
1376
   One place where functionality is still missing is the modeling software
1372
as described in "Statistical Models in S" (see *Note What is S?::).
1377
as described in "Statistical Models in S" (see *Note What is S?::);
1373
Generalized Additive Models (*gam*) and some of the nonlinear modeling code
1378
Generalized Additive Models (*gam*) and some of the nonlinear modeling code
1374
are not there yet.
1379
are not there yet.
1375
 
1380
 
1376
   See also the `PROJECTS' file in the top level R source directory.
1381
   See also the `PROJECTS' file in the top level R source directory.
1377
 
1382
 
1378
   Many (more) of the packages available at the Statlib S Repository might
1383
   Many (more) of the packages available at the Statlib S Repository might
1379
be worth porting to R.
1384
be worth porting to R.
1380
 
1385
 
1381
   If you are interested in working on any of these projects, please notify
1386
   If you are interested in working on any of these projects, please notify
1382
Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at>.
1387
Kurt Hornik <Kurt.Hornik@r-project.org>.
1383
 
1388
 
1384
6 R and Emacs
1389
6 R and Emacs
1385
*************
1390
*************
1386
 
1391
 
1387
6.1 Is there Emacs support for R?
1392
6.1 Is there Emacs support for R?
1388
=================================
1393
=================================
1389
 
1394
 
1390
   There is an Emacs-Lisp interface for interactive statistical programming
1395
   There is an Emacs package which provides a standard interface between
1391
and data analysis called ESS ("Emacs Speaks Statistics").  Languages
1396
statistical programs and statistical processes called ESS ("Emacs Speaks
1392
supported include: S dialects (S 3/4, S-PLUS 3.x, and R), LispStat dialects
1397
Statistics").  It is intended to provide assistance for interactive
1393
(XLispStat, ViSta), and SAS.  Stata and SPSS dialect (SPSS, PSPP) support
1398
statistical programming and data analysis.  Languages supported include: S
1394
is being examined for possible future implementation (a preliminary Stata
1399
dialects (S 3/4, S-PLUS 3.x/4.x/5.x, and R), LispStat dialects (XLispStat,
1395
mode is distributed).
1400
ViSta), SAS, Stata, SPSS dialects (SPSS, Fiasco) and SCA.
1396
 
1401
 
1397
   ESS grew out of the desire for bug fixes and extensions to S-mode 4.8
1402
   ESS grew out of the desire for bug fixes and extensions to S-mode 4.8
1398
(which was a GNU Emacs interface to S/S-PLUS version 3 only).  In
1403
(which was a GNU Emacs interface to S/S-PLUS version 3 only).  The current
1399
particular, XEmacs support as well as extensions to incorporate R were
1404
set of developers desired support for XEmacs, R, S4, and MS Windows.  In
1400
desired.  In addition, with new modes being developed for R, Stata, and
1405
addition, with new modes being developed for R, Stata, and SAS, it was felt
1401
SAS, it was felt that providing for a unifying framework would eliminate
1406
a unifying interface and framework for the user interface, would benefit
1402
differences in the user interface, as well as to provide for faster
1407
both the user and the developer, by helping both groups conform to standard
1403
development of production tools and statistical analysis.  ESS has, for its
-
 
1404
guts, the basic framework from S-mode.  However, it has been cleaned,
-
 
1405
streamlined, brought closer to conformance as a standard GNU Emacs package,
1408
Emacs usage.  The end result is an increase in efficiency for statistical
1406
and redesigned for modularity and reuse.
1409
programming and data analysis, over the usual tools.
1407
 
1410
 
1408
   R support contains code for editing R source code (syntactic indentation
1411
   R support contains code for editing R source code (syntactic indentation
1409
and highlighting of source code, partial evaluations of code, loading and
1412
and highlighting of source code, partial evaluations of code, loading and
1410
error-checking of code, and source code revision maintenance) and
1413
error-checking of code, and source code revision maintenance) and
1411
documentation (including sending examples to a running R process and
1414
documentation (syntactic indentation and highlighting of source code,
1412
previewing), interacting with an inferior R process from within Emacs
1415
sending Examples to running ESS process, and previewing), interacting with
-
 
1416
an inferior R process from within Emacs (command-line editing, searchable
1413
(command-line editing, searchable command history, command-line completion
1417
command history, command-line completion of R object and file names, quick
1414
of R object and file names, quick access to object and search lists,
1418
access to object and search lists, transcript recording, and an interface
1415
transcript recording, and an interface to the help system), and transcript
1419
to the help system), and transcript manipulation (recording and saving
1416
manipulation (in particular for re-evaluating commands from transcript
1420
transcript files, manipulating and editing saved transcripts, and
1417
files).
1421
re-evaluating commands from transcript files).
1418
 
1422
 
1419
   The latest versions of ESS are available from
1423
   The latest versions of ESS are available from
1420
`http://ess.stat.wisc.edu/pub/ESS/' or `ftp://ess.stat.wisc.edu/pub/ESS/',
1424
`http://ess.stat.wisc.edu/pub/ESS/' or `ftp://ess.stat.wisc.edu/pub/ESS/',
1421
or via CRAN.  The HTML version of the documentation can be found at
1425
or via CRAN.  The HTML version of the documentation can be found at
1422
`http://stat.ethz.ch/ESS/'.
1426
`http://stat.ethz.ch/ESS/'.
Line 1905... Line 1909...
1905
ensures that the site profile and saved data files are not read.
1909
ensures that the site profile and saved data files are not read.
1906
 
1910
 
1907
   On Unix systems a bug report can be generated using the function
1911
   On Unix systems a bug report can be generated using the function
1908
`bug.report()'. This automatically includes the version information and
1912
`bug.report()'. This automatically includes the version information and
1909
sends the bug to the correct address.  Alternatively the bug report can be
1913
sends the bug to the correct address.  Alternatively the bug report can be
1910
emailed to <r-bugs@biostat.ku.dk> or submitted to the Web page at
1914
emailed to <r-bugs@lists.r-project.org> or submitted to the Web page at
1911
`http://bugs.r-project.org'.
1915
`http://bugs.r-project.org'.
1912
 
1916
 
1913
   Bug reports on contributed packages should perhaps be sent to the
1917
   Bug reports on contributed packages should perhaps be sent to the
1914
package maintainer rather than to r-bugs.
1918
package maintainer rather than to r-bugs.
1915
 
1919