Why won't R work on my imac? (ggplot, ggplot2)

So I cannot get certain packages to load on R, but when I go to a Windows based OS they work fine. My statistics teacher said R is glitchy on Mac, but I'm wondering if anyone knows how to get these packages to work on R.
This error message: Error in ... : could not find function "xyplot" (same with ggplot)
Anyone else have issues like this with Mac?

Most packages should work normally on MacOS, including ggplot2
What error message do you get while installing the package in your MacOS?

install.packages("ggplot2", dependencies = TRUE)

What error message do you get while loading the library?


One or more of the packages that will be updated by this installation are currently loaded. Restarting R prior to updating these packages is strongly recommended.
RStudio can restart R and then automatically continue the installation after restarting (all work and data will be preserved during the restart).
Do you want to restart R prior to installing?

Yes. (R restarts)
Error in ggplot2(logmod) : could not find function "ggplot2"

ggplot2 is the name of the package, not of the function, also you need to load the library on each new R session to be able to use it, see this example.

# Load the library

ggplot(data = iris, aes(x = Species, y = Sepal.Width)) +

Created on 2019-04-07 by the reprex package (v0.2.1.9000)

1 Like

Error in ggplot2(logmod) : could not find function "ggplot2"

Still giving me the same message

Could you post a screenshot of your code and error message?

So it finally worked! Thank you. I had to restart it and reinstall it, then restart it again, then it worked.

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.