Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

How to Install Multiple R Packages?

  • Last Updated : 06 Oct, 2021

In this article, we will see how to install multiple packages in R Programming Language. Installation can be done in two ways.

Method 1: Installation using application options

Step 1: Open R Studio

Step 2: Navigate to Tools and select the Install packages option 



Step 3: In the Text box packages, enter the package names.

                   

Step 4: Click on install button

Step 5: Find the console after clicking on the install button. If all packages installed successfully the below output will be generated. Otherwise, follow the steps again.



Method 2: Using command

In this method simply specify the packages to be installed as a vector to install.packages() function.

Syntax:

install.packages(c(“package1″,….,”package n”))

Example

R




install.packages(c("ggplot2","dpylr"))

Loading multiple packages 

To load multiple packages at once specify the names of the packages ot be loaded ot lapply() function.

Syntax:

lapply(c(“package 1″,…”package n”), require, character.only = TRUE)

Example:

R




lapply(c("dpylr", "ggplot2"), require, character.only = TRUE)
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!