Skip to content
Related Articles

Related Articles

Manage packages in R

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 28 Mar, 2022

In this article, we will see how to manage packages in R Programming Language using R script.

What are R packages?

R packages are the set of functions and datasets written in a single code and are stored in a directory called library. 

We will be looking at:

  • How to Install packages
  • How to Uninstall packages
  • How to Update packages
  • How to find all the installed packages

Using R pre-defined functions.

How to Install packages:

To install the package in R use install.packages(“packagename”) and replace packagename by the package you want to install.

Syntax:

install.packages(“packagename”)

Note: packagename is case-sensitive.

R




install.packages("httr")


Output:

 

How to Uninstall packages:

To uninstall/remove the package from your device use remove.package(“packagename”) and replace the package name by the package you want to uninstall/remove. This function will remove the package if it is already installed.

Syntax:

remove.packages(“packagename”)

R




remove.packages("httr")


Output:

 

How to Update packages:

To update the package we use update.package() and it does not require any parameters. This function will update all the packages running on the older version.

Syntax:

update.packages()

R




update.packages()


Output:

 

How to find all the installed packages:

To get the installed packages on the device we use installed.packages() and it does not need any parameters as well. This function will show all the installed packages on the device.

Syntax:

installed.packages()

installed.packages() will return all the installed functions on the system.

R




installed.packages()


Output:

 


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!