What are Packages in R?

R packages are a collection of R functions, complied code and sample data. They are stored under a directory called “library” in the R environment. By default, R installs a set of packages during installation. More packages are added later, when they are needed for some specific purpose.

Following is a list of commands to be used to check, verify and use the R packages.

  • Get library locations containing R packages

.libPaths()

  • Get the list of all the packages installed
library()
  • Get all packages currently loaded in the R environment

search()

There are multiple ways to install R Package, below is one of them are,

  • Installing Packages From CRAN: For installing Package from CRAN we need the name of the package and use the following command:

install.packages("package name")

In this session we will learn in detail, what are packages and how to use them.