regards, Lin
New to R Studio and wondering to install new package like ggplot2 (or any other additional packages/libraries), any convenient ways? Thanks.
regards, Lin
# Load ggplot2
library("ggplot2")
You can do what Heroka said, which is the quickest way, except that you have to know the exact name of the package you want to install.
The other way is to go to the bottom right quadrant and select the "packages" tab and click on "install packages" above the list. This will open a new window where you will select what package you want to install, where on your system and from where. Also, there's auto-completion, so you just have to enter the first letters and select which package you want.
The advantage to doing things in script (library(ggplot2)) is that loading a package can be saved at the top of the script and easily run every time you run a script. Clicking cannot be saved, and must be done manually every time.
The ggplot2 package can be easily installed using the R function install.packages()
.
install.packages("ggplot2")
The ggplot2 package can be easily installed using the R function install.packages()
.
You need to type the following R code in the console:
install.packages("ggplot2")