You are on page 1of 1

4/8/13

Installing R Packages

Tags computing, r
Edited Feb 8, 2010 9:48 AM by Jose Hales-Garcia

Installing R Packages
Installing individual packages: You can download and install R packages using the install.packages() command. # Downloads and installs the Rpvm package >i n s t a l l . p a c k a g e s ( " R p v m " ) Finding available packages: If you are not sure what the package's name is, you can list all available packages using the command available.packages(). The command will return a list of all packages registered with the CRAN mirror site. # List information on all packages registered with the CRAN mirror site. >a v a i l a b l e . p a c k a g e s ( ) Switching CRAN mirror sites: The default CRAN mirror setting is http://cran.us.r-project.org. The mirror setting can be changed with: # Switch to the UCLA CRAN mirror site. >o p t i o n s ( C R A N=" h t t p : / / c r a n . s t a t . u c l a . e d u " ) Installing all packages: If you want to install every package that exists at a mirror site, you can combine commands: # Install all packages that exist at the CRAN mirror site. >i n s t a l l . p a c k a g e s ( a v a i l a b l e . p a c k a g e s ( ) [ , 1 ] ) The [,1] selector picks out the second column of the array returned by available.packages(), which happens to contain the names of the packages.

answers.stat.ucla.edu/groups/answers/wiki/37ced/

1/1

You might also like