QBoard » Artificial Intelligence & ML » AI and ML - R » ggplot2 library installation in R Studio

ggplot2 library installation in R Studio

  • New to R Studio and wondering to install new package like ggplot2 (or any other additional packages/libraries), any convenient ways? Thanks.

    regards, Lin

     
      December 14, 2021 12:06 PM IST
    0
  • # Load ggplot2
    library("ggplot2")
      December 30, 2021 1:03 PM IST
    0
  • 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.

    enter image description here

    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.

      December 15, 2021 12:29 PM IST
    0
  • The ggplot2 package can be easily installed using the R function install.packages().

    install.packages("ggplot2")
    
      January 14, 2022 2:13 PM IST
    0
  • 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")
    
      December 18, 2021 11:49 AM IST
    0