2.4 Package installation

Let’s install the tidyverse package.

There are two ways to install an R package:

  • In the Files pane:
    • Click on “Packages”
    • Click on “Install”
    • Type the name of the package under “Packages (separate multiple with space or comma):” In this case, type tidyverse
    • Click “Install”
  • Alternatively, in the Console pane type the following

Later, when you start using R Markdown, never include the following “install.packages” code within your R Markdown document; only install packages by typing directly in the Console!


If you are attempting to install a package (using install.packages) and you get this message:

There is a binary version available but the source version is later:
  binary source needs_compilation
systemfonts  1.0.2  1.0.3              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel)

Respond with “no” (without quotes). Do NOT respond “Yes”.

When working on your own computer, you only need to install a package once, unless you want to update an already installed package to the latest version (something you might do every 6 months or so). HOWEVER: If you’re working on a school computer (in a computer lab or in the library), you may need to install packages each session, because local files (on the computer) are automatically deleted daily. If you’re unsure what packages are already installed, consult the “packages” tab in the lower-right RStudio pane when you start up RStudio; installed packages are listed there.