DEV Community

Dr. Azad Rasul
Dr. Azad Rasul

Posted on • Updated on

3- Dealing with packages in R Programming

R packages are combinations of functions and data sets created as extensions to R. While, library in R indicates the place where the package is held.

Install packages

install.packages('ggplot2') # ggplot2 is An implementation of the grammar of graphics in R
Enter fullscreen mode Exit fullscreen mode

To install more than one packages together

install.packages(c("dplyr", "devtools", "foreign")) 
#dplyr package is a grammar of data manipulation
#devtools package is a combination of package development tools
#foreign package used for read data stored by other statistical software such as Minitab, S, SAS, SPSS, and Stata.
Enter fullscreen mode Exit fullscreen mode

You can also install packages from RGui: Packages> Install package(s)

and from RStudio from: Tools>Install Packages

Call packages

Before using any packages you have to load them using library function.

library(ggplot2) # to load functions from the package we have to call it.
Enter fullscreen mode Exit fullscreen mode

Remove packages

You can remove any packages that you do not need:

remove.packages("ggplot2") # for remove a package
Enter fullscreen mode Exit fullscreen mode

Update packages

Check old packages that need an update

old.packages()

# for update all packages
update.packages()
Enter fullscreen mode Exit fullscreen mode

If you like the content, please SUBSCRIBE to my channel for the future content

To get full video tutorial and certificate, please, enroll in the course through this link:
https://www.udemy.com/course/r-for-research/?referralCode=B6DCFDE343F0592EA61A

Top comments (0)