-
Notifications
You must be signed in to change notification settings - Fork 24
Installing Packages
christophergandrud edited this page May 24, 2012
·
6 revisions
R comes with a basic set of commands. These are stored in base
R and always load when you open RStudio.
However, the range of functions in base
R is fairly small. One of the best things about R is its thousands of user-created packages. Basically, people who wanted to be able to do something in R created new sets of commands to make it happen.
To use functions in packages other than base
R:
- First, install the package you want with the
install.packages
command. For example, if the package is called "package
", then just:
install.packages("package")
R will likely ask you which "CRAN Mirror" to install the package from. Just follow the on screen instructions to choose the mirror that is geographically closest to you.
- Second, load the package using the
library
command:
library(package)
In general you will need to use library(package)
each time you want to use the package per R session.