Installing Packages on RStudio Desktop

A multitude of packages are available that extend the capability of R and RStudio Desktop, such as analysis packages and useful utilities. These packages are provided for your use by those who develop them. As with all open source software, consider the source and use at your own risk. Let's install BiocManager package. BiocManager is an R package that allows you to install all other Bioconductor packages from the Bioconductor repository. If you have not heard of Bioconductor, it is the *Open Source Software for Bioinformatics. This repository is curated and is generally of high quality. *Click on the link below to learn more.

Bioconductor - Home

Here is an overview for this webpage:

  • CRAN package Repository - What is CRAN?
  • Installing CRAN and Bioconductor Packages - Installing packages and getting help.

CRAN package Repository

The Comprehensive R Archive Network or CRAN. CRAN is described by the R Website as:

... a network of ftp and web servers around the world that store identical, up-to-date, versions of code and documentation for R.

CRAN hosts a set of statistical computing and graphics packages. In addition, it has many utilities for simplifying its use. As of June 2020, there are 15,801 available packages. Good luck on finding the right one for your needs. Information on CRAN and how to find packages is provided with the link below:

The Comprehensive R Archive Network

We will install a CRAN package BiocManager, which is a utility for installing and managing Bioconductor software packages and package dependancies. A single Bioconductor analysis packages can have a long list of dependency software: system software, other Bioconductor package and CRAN packages. BiocManager deals with further complications of dependent package versions with a single command.

Installing CRAN and Bioconductor Packages

  1. Launch RStudio Desktop from the Applications folder as you did before. Click the + item (upper far-left in graphic below) and open a new R Script.

    Installing%20Packages%20on%20RStudio%20Desktop%201f828475e4534100942521ecdcbd0ea4/junk.jpg

  2. In the upper-left pane, type the following command and click the Source button (right-top) to execute a single line of code or Run which executes all of the windows commands. You can save this file as a permanent record of the commands you used. Or, you can type these commands directly into the Console pane (lower-left window) and hit return button. Saving the commands in an R script file is best for repeatability and documentation. Type in the code:

    if (!requireNamespace("BiocManager", quietly = TRUE))` `install.packages("BiocManager") BiocManager::install(version = "3.11")

    Installing%20Packages%20on%20RStudio%20Desktop%201f828475e4534100942521ecdcbd0ea4/pane1.jpg

  3. You will be prompted in the Console pane (lower-left). Click on the Console pane and type a and hit the return key to install all required packages

    Installing%20Packages%20on%20RStudio%20Desktop%201f828475e4534100942521ecdcbd0ea4/Console_Pane.jpg

  4. To learn about the BiocManager package, type ??BiocManager in the Console pane.

    Installing%20Packages%20on%20RStudio%20Desktop%201f828475e4534100942521ecdcbd0ea4/dddd.jpg

    Click on the Help tab in the lower-right pane and click BiocManager::BiocManager link.

    Installing%20Packages%20on%20RStudio%20Desktop%201f828475e4534100942521ecdcbd0ea4/help.png

  5. Try on your own to install DESeq2 package with BiocManager::install("DESeq2") . After installation, type ??DESeq2 in the console section. Use the instructions from the link below:

    DESeq2

  6. Bioconductor Repository. Find packages for version 3.1.1 with the link below

    Bioconductor Software Packages

  7. Try to install ggplot2 from R CRAN repository using install.packages("ggplot2") and learn about it with ??ggplot2 .

  8. Final notes:
    • Package names are case sensitive.
    • Use install.packages(), to install packages from the CRAN repository.
    • Use BiocManager::install() to install packages specific to Bioconductor repository.
    • To use a package, you must install once and load each time:
      • Install once - install.packages("DESeq2")
      • Load each time to use - library("DESeq2")
      • Get information about the package - ??ggplot2