How to install packages on R + screenshots

January 31, 2013
By

(This article was first published on Learning Omics » R, and kindly contributed to R-bloggers)

Have no fear, the screenshots are here! (For the original tutorial, click here)

Method 1 (less typing)

Part 1-Getting the Package onto Your Computer

  1. Open R via  your preferred method (icon on desktop, Start Menu, dock, etc.)install
  2. Click “Packages” in the top menu then click “Install package(s)”. install1
  3. Choose a mirror that is closest to your geographical location.install2
  4. Now you get to choose which packages you want to install. If you would like to install multiple packages, click on each one while holding the CTRL key or the cloverleaf-looking key. For now just highlight “ggplot2″.install3
  5. You will know when the package has been downloaded onto your computer when another greater-than symbol (“>”) appears.install5

Part 2-Loading the Package into R

  1. Type “library(ggplot2)” and then press the Enter/Return key.install6
  2. All done.install7

You will only need to do Part 1 once time on your computer. From now on, you only need to do Part 2 each time you close and restart R.

Method 2 (Quicker)

Use this method once you get more acquainted with the whole copy and paste business. It is much quicker than Method 1.

Part 1-Getting the Package onto Your Computer

  1. Type “install.packages(“gplots”)” and then press the Enter/Return key.install8
  2. If you have already loaded a package from a server in the R session, then R will automatically install the package. If not, R will automatically prompt you to choose a mirror. Again, choose one close to unless you want to watch a loading bar slowly inch its way to fulfillment.install10

Part 2-Loading the Package into R

  1. Type “library(gplots)” and then press the Enter/Return key.install11
  2. All done. R will spit out a lot more output because it needs to install other packages required for gplots.install12

Again, you will only need to do Part 1 one time on your computer. From now on, you only need to do Part 2 each time you close and restart R.


To leave a comment for the author, please follow the link and comment on his blog: Learning Omics » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.