How to install ggplot2 package in R

What is ggplot2?

ggplot2 package is used to produce statistical, or data, graphics based on Grammar of Graphics. ggplot2 provides beautiful hassle-free plots. To use ggplot2,e have to install it. To use ggplot2 package, first we have to install it and then load it.

Install ggplot2 package in R:

1. Install ggplot2 package with R function install.packages(“package_name”)

> install.packages("ggplot2") Installing package into ‘C:/Users/pinnapav/Documents/R/win-library/3.3’ (as ‘lib’ is unspecified) trying URL '' Content type 'application/zip' length 2762463 bytes (2.6 MB) downloaded 2.6 MB package ‘ggplot2’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\pinnapav\AppData\Local\Temp\RtmpMjkRPJ\downloaded_packages

How to install ggplot2 package in R

2. Load the package using R function library(package_name)

> library(ggplot2) Warning message: package ‘ggplot2’ was built under R version 3.3.3

3. Verification, press Ctrl+7 in RStudio.

Related Posts

Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools
%d bloggers like this: