ggplot2 install error

I am unable to install ggplot2, and have run into the following errors-.
Thanks, in advance.


Error: unable to load R code in package 'ggplot2'
Execution halted
ERROR: lazy loading failed for package 'ggplot2'

  • removing 'C:/Users/bjohnso3/AppData/Local/R/win-library/4.2/ggplot2'

The downloaded source packages are in
‘C:\Users\bjohnso3\AppData\Local\Temp\Rtmpu4XfWZ\downloaded_packages’
Warning message:
In utils::install.packages("ggplot2") : installation of package ‘ggplot2’ had non-zero exit status

Hi, welcome to the forum.
Can you tell us what your OS asd RStudio velsios are?
Also would you supply us with the output of

sessionInfo()

Also, I can think of two R packages, {pak} and {pacman} that are intended to help facilitate smooth package installation. You might want to install one or both and see if either helps.

Many thanks for this--- I had uninstalled and reinstalled RStudio multiple times without it working--- Turned out I had to (re)install R first, then RStudio. I'm all set now. Thank you again!

Great. Good to hear it.

Something else I forgot that often helps with weird problems of many sorts is resetting RStudio Desktop's State.
(https://support.rstudio.com/hc/en-us/articles/200534577-Resetting-RStudio-Desktop-s-State)