Loading R Packages

Installing a package does not make it immediately available to you in R; you must load the package. The library() function is used to load packages into R. The following code is used to load the ggplot2 package into R. Do not put the package name in quotes.

library(ggplot2)

If you have Installed your packages without root access using the command install.packages(“ggplot2″, lib=”/data/Rpackages/”). Then to load use the below command.

library(ggplot2, lib.loc="/data/Rpackages/")

After loading a package, the functions exported by that package will be attached to the top of the search() list (after the workspace).

library(ggplot2)
search()

Installing R Packages

Take Input and Print in R