Error in ggplot iris aes x Species y Sepal Length could not find function ggplot

0 votes

Hi Guys,

I am trying to plot my dataset using ggplot, but it is showing me the below error.

ggplot(iris, aes(x = Species, y = Sepal.Length)) + geom_boxplot() + theme_bw()
Error in ggplot(iris, aes(x = Species, y = Sepal.Length)) : 
could not find function "ggplot"
Jun 9, 2020 in Data Analytics by akhtar
• 38,170 points
575 views

1 answer to this question.

0 votes

Hi@akhtar,

You have to install ggplot module in your r studio. You can use the below-given code.

> install.packages("ggplot2")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/Nadeem Akhter/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
package ‘pkgbuild’ successfully unpacked and MD5 sums checked
package ‘rprojroot’ successfully unpacked and MD5 sums checked
package ‘rstudioapi’ successfully unpacked and MD5 sums checked
package ‘evaluate’ successfully unpacked and MD5 sums checked
package ‘pkgload’ successfully unpacked and MD5 sums checked
package ‘praise’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Nadeem Akhter\AppData\Local\Temp\Rtmps3pgcC\downloaded_packages

Hope this will help.

answered Jun 9, 2020 by MD
• 95,180 points

Related Questions In Data Analytics

+1 vote
1 answer
+1 vote
1 answer

Error saying "could not find function "shinyUI"" in shiny R

Its a small spelling mistake that you've ...READ MORE

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,840 points
1,275 views
+1 vote
1 answer

Error saying "could not find function dashboardPage" in shiny R

Include this line in the code: Library(shinydashboard) READ MORE

answered Nov 28, 2018 in Data Analytics by Maverick
• 10,840 points
1,067 views
0 votes
1 answer

Error saying "Error in df$item : object of type 'closure' is not subsettable" when trying to use arules package

Try replacing ID <- c("A123","A123","A123","A123","B456","B456","B456") item <- c("bread", "butter", ...READ MORE

answered Nov 15, 2018 in Data Analytics by Maverick
• 10,840 points
668 views
+1 vote
1 answer
0 votes
1 answer
+1 vote
2 answers

Which function can I use to clear the console in R and RStudio ?

Description                   Windows & Linux           Mac Clear console                      Ctrl+L ...READ MORE

answered Apr 17, 2018 in Data Analytics by anonymous
29,400 views