Steps to install R packages in R studio
- Open RStudio
- Click on the packages in R console at the bottom right corner of Rstudio
- Click on Install. Pop up window will appear
- Search for the packages in the pop up window
- For example search for “ggplot2” package
- Click and select the package (ggplot2) which you are looking for in the search results
- Now click on the install icon
- Click Install and Install dependencies
- This will install the package “ggplot2”
- Check whether the package has been installed successfully by using the command
- Library(ggplot2) If this command runs, then you have installed the package successfully
Alternatively, you can also use R command to install a package in Rstudio
- The command for installing a package in Rstudio is
- install.packages(“package_name”)
- install.packages(“ggplot2”)
- Run the command
- This will install the package “ggplot2”
- Check whether the package has been installed successfully by using the command
- Library(ggplot2) If this command runs, then you have installed the package successfully