R Handbook
R Handbook
R Handbook
What is R?
R is a programming language and software environment for statistical computing and graphics.
The R language is widely used among statisticians and data miners for developing statistical
software. R is an implementation of the S programming language combined with lexical
scoping semantics inspired by Scheme. S was created by John Chambers while at Bell Labs.
What is RStudio?
RStudio is a free and open source integrated development
a programming language for statistical computing and graphics.
environment (IDE)
for R,
RStudio is available in two editions: RStudio Desktop, where the program is run locally as a
regular desktop application; and RStudio Server, which allows accessing RStudio using a web
browser while it is running on a remote Linux server. Prepackaged distributions of RStudio
Desktop are available for Microsoft Windows, Mac OS X, and Linux.
Why R is named R?
The name is partly based on the (first) names of the first two R authors (Robert Gentleman and
Ross Ihaka), and partly a play on the name of the Bell Labs language S
What is S?
S is a very high level language and an environment for data analysis and graphics.
What machines does R run on?
R is being developed for the Unix-like, Windows and Mac families of operating systems.
Support for Mac OS Classic ended with R 1.7.1.
What is CRAN?
The Comprehensive R Archive Network (CRAN) is a collection of sites which carry identical
material, consisting of the R distribution(s), the contributed extensions, documentation for R, and
binaries.
What is the difference between package and library?
A package is a standardized collection of material extending R, e.g. providing code, data, or
documentation. A library is a place (directory) where R knows to find packages it can use (i.e.,
which were installed). R is told to use a package (to load it and add it to the search path) via
calls to the function library. I.e., library() is employed to load a package from libraries containing
packages.
What R packages do I already have?
To get a list of installed packages, execute library() at the R prompt. R will first list all the
packages installed in your local R directory and then it will list all of the packages installed
globally on your system
#list all R packages installed
> library()
How can I find additional information about R packages I have?
If you would like to get additional information about the installed packages you can access it
using installed.packages() at the R prompt
#obtain information about installed R packages
> installed.packages()
How do I install and Remove a new package?
Install from CRAN directly. A package can be installed using install.packages("package
name") at the R prompt.
# Install xxx package
> install.packages("xxx")
A package can be removed using remove.packages("package name") at the R prompt:
# Remove xxx package
> remove.packages("xxx")
Where are my R packages installed?
You can view the list of the packages along with their paths running path.package() at the R
prompt
#where are my R packages installed
> path.package()
I installed a package but the functions are not there
To actually use the package, it needs to be loaded using library().