installing ggplot2 and not working

when I install ggplot2 I get the following error. It seems that it has installed, but it is not working when plotting.

install.packages("ggplot2")
Installing package into ‘C:/Users/IT FIX/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/ggplot2_3.3.5.zip'
Content type 'application/zip' length 4130719 bytes (3.9 MB)
downloaded 3.9 MB

package ‘ggplot2’ successfully unpacked and MD5 sums checked

It looks like it should be installed.

You are loading it using

library(ggplot2)

What happens if you run this code?

library(ggplot2)
dat1 <-   data.frame(xx = 1:10, yy = 10:1)
ggplot(dat1, aes(xx, yy)) + geom_point()

your code is working, but I do not know when it comes to my data it is not working.

Okay, at least we know the installation was successful.

To do more we need a reproducible example (reprex)

A handy way to supply sample data is to use the dput() function. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with.

Are you getting any error messages? If so be sure to include them.

Thank you for your help. It is working now.

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.