R Studio Issue - GGPLOT 2 - Please Help!!

I am new to using R Studio on my Macbook Pro Mid 2012 running R Studio. Mac OSX 10.15.7. This is first time using this for my MBA class and never used R Studio or R prior to this class.

I have tried to download caret onto R Studio, but am having an error message.

Can somebody please assist in telling me how to get caret installed? Is there system limitations or some type of error message? Please see attached photos.

Thanks!

Screen Shot 2024-08-28 at 2.27.39 PM

Try running install.packages("ggplot2") in the console. Also, note the warning message, which suggests you should probably upgrade to the current version of RStudio.

1 Like

here is a binary version available but the source version is later:
binary source needs_compilation
ggplot2 3.4.4 3.5.1 FALSE

installing the source package ‘ggplot2’

trying URL 'https://cran.rstudio.com/src/contrib/ggplot2_3.5.1.tar.gz'
Content type 'application/x-gzip' length 3604371 bytes (3.4 MB)

downloaded 3.4 MB

  • installing source package ‘ggplot2’ ...
    ** package ‘ggplot2’ successfully unpacked and MD5 sums checked
    ** using staged installation
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** inst
    ** byte-compile and prepare package for lazy loading
    Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
    there is no package called ‘munsell’
    Calls: ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
    Execution halted
    ERROR: lazy loading failed for package ‘ggplot2’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/ggplot2’
    Warning in install.packages :
    installation of package ‘ggplot2’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/67/h64hl6t117q0x0wh2pvld7g40000gn/T/RtmpCXuWPb/downloaded_packages’
Warning message:
R graphics engine version 15 is not supported by this version of RStudio. The Plots tab will be disabled until a newer version of RStudio is installed.

that is my error message.

I cannot upgrade to a new R version due to my laptop?

I don't believe I can upgrade to a current version of R Studio, due to my Macbook OS limitations. Can you confirm?

Screen Shot 2024-08-28 at 2.54.15 PM
See attached photo when I check for updates

I believe you are correct. The current version of RStudio needs macOS 12 or higher. That should not stop you from using the version you have, but you apparently will not be able to see plots in the Plots tab.

So how can I download caret? Or am I not able to? I am still getting the same issue that I originally posted.

This is surprising. The issue here seems to be dependencies: caret requires ggplot2 (and maybe other libraries), ggplot2 requires munsell (and maybe other libraries), and so on. The install.packages() command should be installing the dependencies but is not. You can try install.packages("ggplot2", type = "mac.binary") and see if that works better. Updating your operating system might help if it is possible.

This is what happens when I try to install that install.packages("gplot2," type="mac.binary").

Screen Shot 2024-08-28 at 3.07.16 PM

Screen Shot 2024-08-28 at 3.08.01 PM
I cannot update my mac any further. See photo.

OK, try install.packages("ggplot2", dependencies = TRUE, type = "mac.binary"). (I'm grasping at straws here.)

Take a look at the attachment sfor what the code says, after doing what you had suggested. They are in order

Screen Shot 2024-08-28 at 3.17.39 PM

This all looks normal. You apparently are missing quite a few packages that are needed (or at least desired). The messages here indicate about 15 of them were downloaded. The question is whether the rest were downloaded and, importantly, whether they installed successfully.

Try install.packages("caret", dependencies = TRUE, type = "mac.binary"). This may reinstall the caret package, and hopefully (maybe) (possibly) will install its various dependencies.

It sounds like you're having trouble installing the caret package in R Studio. The error with ggplot2 might indicate missing dependencies or compatibility issues. Make sure you have the latest version of R and RStudio installed. Try updating ggplot2 first with install.packages('ggplot2'), then install caret again. If you still encounter issues, check the error message for more details or consult the RStudio community forums for specific help.