12.5 Load Data From A package On CRAN

Most packages don’t come with R when you download it but are stored in a central site called CRAN. We’ll load data from the cowplot package.

12.5.1 Loading packages using R-Studio

RStudio makes it easy to find and load packages. Follow these instructions.

  • In the panel of RStudio that has the tabs “Plots”, “Packages”,“Help”, “Viewer” click on “Packages”"
  • On the next line it says “Install” and “Update”. Click on “Install”
  • A window will pop up. In the white field in the middle of the window under “Packages” type the name of the package you want.
  • RStudio will automatically bring up potential packages as you type.
  • Finish typing “cowplot” or click on the name.
  • Click on the “Install” button.
  • In the source viewer some misc. test should show up. Most of the time this works. If it doesn’t, talk to the professor!

If an R packages doesn’t load properly, it could be for several reasons.

  1. Your internet connection might be having problems.
  2. The website where the package is stored might be down for maintenance.
  3. The version of are you are using is probably newer than the version of R used to make the package. This is a real pain - ask for help from an expert R user if think you have this problem.