install.packages("ggplot2") # To install an R package
install.packages(c("devtools", "lme4")) # To install multiple packages
If you want to use RStudio’s Graphical Interface to install packages:
Tools > Install Packages > type the desired packages in the appropriate box
install.packages("BiocManager") # Install BiocManager from Cran
BiocManager::install("GenomicFeatures")
Use column vector c() in install() to install multiple packages.
Take note of package name and its author.
install.packages("devtools")
library(devtools) # Load devtools using library() function
install_github("<author>/<package>")
library(<package>) # To load the package; quotes ("") are not required
Or, loading packages using RStudio’s graphical interface:
Packages (bottom-right quadrant) > click on the corresponding checkbox
packageVersion("<package>") # to check the version of a specific package
old.packages() # to identify which packages need an update
update.package() # to update all packages
install.packages("<package>") # to update a single package
To update using RStudio’s graphical interface:
Packages > Update > select the package you want to update
detach("package:<package>", unload = TRUE)
To unload packages from RStudio’s graphical interface:
un-check the checkbox corresponding to the package you want to unload
remove.packages("<package>")
To uninstall a package using graphical interface:
Click on the X at the end of the package line in the Packages tab
help(package = "<package>") # to find out all the functions of a package
browseVignettes("<package>") # to get a detailed description of a package
Using the graphical interface, click on the package name.
version
sessionInfo()