pacman Package in R
Last Updated :
02 Jun, 2022
In this article, we will be discussing briefly the pacman package with its working examples in the R programming language.
Pacman Package in R
Tyler Rinker, Dason Kurkiewicz, Keith Hughitt, Albert Wang, Garrick Aden-Buie, and Lukas Burk created the Pacman R package. The package contains tools for easily managing add-on packages in the R programming language. The package relies on Base R functions as a library() and install.packages() and merges them into new, more intuitive, and efficient procedures.
To use the functions provided in the Pacman package, we must first install and load the package to R: After running the aforementioned lines of code, we may use the Pacman package’s functionality.
R
install.packages ( "pacman" )
library ( "pacman" )
|
Using the load Function to Install and Load Multiple R Packages. Here, we will look at how to use the p load method to load the three packages ggplot2, dplyr, and stringr after running the prior code, add on packages in a single line of code below code:
R
p_load (ggplot2, dplyr, stringr)
|
Using the pacman package to update Outdated R Packages:
In this example, we will look at how to utilize the Pacman package’s p update function to check for outdated packages and then update them all.
First, let’s see whether of my packages is out of date:
Output:
[1] “jakarta” “honeyloom” “gfg.table” “othertask” “ggplot2” “isoband”
[7] “anomaliy” “risic” “lineworker” “rookiepool”
Fortunately, the Pacman package provides a simple way for updating all outdated packages with a single line of R code. Before running the following R code, make sure you have some time. This could take some time depending on how many packages you need to update:
p unload Function
The p unload function is another useful feature of the Pacman package. The p unload function can be used from within R to unload one or more loaded packages. Let’s use the p unload command to uninstall the three packages we previously loaded: ggplot2, dplyr, and stringr:
R
p_unload (ggplot2, dplyr, stringr)
|
Share your thoughts in the comments
Please Login to comment...