ggplot function error 3

In the following code, r studio is saying that it cannot find a function for ggplot.
Is there any way to fix this?

p <- 0.15
n <- 100

data1 <- rnorm(n=n, mean=p, sd=sqrt(p*(1-p)/n))
data <- as.data.frame(data1)

ggplot(data, aes(x = data1)) +
geom_histogram(color = "white") +
xlim(0, 0.3) +
labs(y ="Count", x = "p-hats", title="n=100")

Add before the call

library(ggplot2)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.