Skip to content
Snippets Groups Projects
FAQ 116 KiB
Newer Older
R FAQ
Frequently Asked Questions on R
Version 2020-08-03
Kurt Hornik



R FAQ
1 Introduction
  1.1 Legalese
  1.2 Obtaining this document
  1.3 Citing this document
  1.4 Notation
  1.5 Feedback
2 R Basics
  2.1 What is R?
  2.2 What machines does R run on?
  2.3 What is the current version of R?
  2.4 How can R be obtained?
  2.5 How can R be installed?
    2.5.1 How can R be installed (Unix-like)
    2.5.2 How can R be installed (Windows)
    2.5.3 How can R be installed (Mac)
  2.6 Are there Unix-like binaries for R?
  2.7 What documentation exists for R?
  2.8 Citing R
  2.9 What mailing lists exist for R?
  2.10 What is CRAN?
  2.11 Can I use R for commercial purposes?
  2.12 Why is R named R?
  2.13 What is the R Foundation?
  2.14 What is R-Forge?
3 R and S
  3.1 What is S?
  3.2 What is S-PLUS?
  3.3 What are the differences between R and S?
    3.3.1 Lexical scoping
    3.3.2 Models
    3.3.3 Others
  3.4 Is there anything R can do that S-PLUS cannot?
  3.5 What is R-plus?
4 R Web Interfaces
5 R Add-On Packages
  5.1 Which add-on packages exist for R?
    5.1.1 Add-on packages in R
    5.1.2 Add-on packages from CRAN
    5.1.3 Add-on packages from Bioconductor
    5.1.4 Other add-on packages
  5.2 How can add-on packages be installed?
  5.3 How can add-on packages be used?
  5.4 How can add-on packages be removed?
  5.5 How can I create an R package?
  5.6 How can I contribute to R?
6 R and Emacs
  6.1 Is there Emacs support for R?
  6.2 Should I run R from within Emacs?
  6.3 Debugging R from within Emacs
7 R Miscellanea
  7.1 How can I set components of a list to NULL?
  7.2 How can I save my workspace?
  7.3 How can I clean up my workspace?
  7.4 How can I get eval() and D() to work?
  7.5 Why do my matrices lose dimensions?
  7.6 How does autoloading work?
  7.7 How should I set options?
  7.8 How do file names work in Windows?
  7.9 Why does plotting give a color allocation error?
  7.10 How do I convert factors to numeric?
  7.11 Are Trellis displays implemented in R?
  7.12 What are the enclosing and parent environments?
  7.13 How can I substitute into a plot label?
  7.14 What are valid names?
  7.15 Are GAMs implemented in R?
  7.16 Why is the output not printed when I source() a file?
  7.17 Why does outer() behave strangely with my function?
  7.18 Why does the output from anova() depend on the order of factors in the model?
  7.19 How do I produce PNG graphics in batch mode?
  7.20 How can I get command line editing to work?
  7.21 How can I turn a string into a variable?
  7.22 Why do lattice/trellis graphics not work?
  7.23 How can I sort the rows of a data frame?
  7.24 Why does the help.start() search engine not work?
  7.25 Why did my .Rprofile stop working when I updated R?
  7.26 Where have all the methods gone?
  7.27 How can I create rotated axis labels?
  7.28 Why is read.table() so inefficient?
  7.29 What is the difference between package and library?
  7.30 I installed a package but the functions are not there
  7.31 Why doesn't R think these numbers are equal?
  7.32 How can I capture or ignore errors in a long simulation?
  7.33 Why are powers of negative numbers wrong?
  7.34 How can I save the result of each iteration in a loop into a separate file?
  7.35 Why are p-values not displayed when using lmer()?
  7.36 Why are there unwanted borders, lines or grid-like artifacts when viewing a plot saved to a PS or PDF file?
  7.37 Why does backslash behave strangely inside strings?
  7.38 How can I put error bars or confidence bands on my plot?
  7.39 How do I create a plot with two y-axes?
  7.40 How do I access the source code for a function?
  7.41 Why does summary() report strange results for the R^2 estimate when I fit a linear model with no intercept?
  7.42 Why is R apparently not releasing memory?
  7.43 How can I enable secure https downloads in R?
  7.44 How can I get CRAN package binaries for outdated versions of R?
8 R Programming
  8.1 How should I write summary methods?
  8.2 How can I debug dynamically loaded code?
  8.3 How can I inspect R objects when debugging?
  8.4 How can I change compilation flags?
  8.5 How can I debug S4 methods?
9 R Bugs
  9.1 What is a bug?
  9.2 How to report a bug
10 Acknowledgments
R FAQ
*****

1 Introduction
**************

This document contains answers to some of the most frequently asked
questions about R.

1.1 Legalese
============

This document is copyright © 1998-2020 by Kurt Hornik.

   This document is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.

   This document is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.

   Copies of the GNU General Public License versions are available at

     <https://www.R-project.org/Licenses/>

1.2 Obtaining this document
===========================

The latest version of this document is always available from

     <https://CRAN.R-project.org/doc/FAQ/>

   From there, you can obtain versions converted to plain ASCII text,
GNU info, HTML, PDF, as well as the Texinfo source used for creating all
these formats using the GNU Texinfo system.

   You can also obtain the R FAQ from the 'doc/FAQ' subdirectory of a
CRAN site (*note What is CRAN?::).

1.3 Citing this document
========================

In publications, please refer to this FAQ as Hornik (2020), "The R FAQ",
and give the above, _official_ URL:

     @Misc{,
       author        = {Kurt Hornik},
       title         = {{R} {FAQ}},
       year          = {2020},
       url           = {https://CRAN.R-project.org/doc/FAQ/R-FAQ.html}
     }

1.4 Notation
============

Everything should be pretty standard.  'R>' is used for the R prompt,
and a '$' for the shell prompt (where applicable).

1.5 Feedback
============

Feedback via email to <Kurt.Hornik@R-project.org> is of course most
welcome.

   In particular, note that I do not have access to Windows or Mac
systems.  Features specific to the Windows and macOS ports of R are
described in the "R for Windows FAQ"
(https://CRAN.R-project.org/bin/windows/base/rw-FAQ.html) and the "R for
Mac OS X FAQ" (https://CRAN.R-project.org/bin/macosx/RMacOSX-FAQ.html).
If you have information on Mac or Windows systems that you think should
be added to this document, please let me know.

2 R Basics
**********

2.1 What is R?
==============

R is a system for statistical computation and graphics.  It consists of
a language plus a run-time environment with graphics, a debugger, access
to certain system functions, and the ability to run programs stored in
script files.

   The design of R has been heavily influenced by two existing
languages: Becker, Chambers & Wilks' S (*note What is S?::) and
Loading
Loading full blame...