Synth Package Installs in Console but not Rstudio

Hi, I'm totally new to R and specifically looking to be able to run a particularly stats package. On the R Console, I'm able to type install.packages("Synth") and it downloads perfectly fine using a mirror from IA State (USA): https://mirror.las.iastate.edu/CRAN/bin/macosx/contrib/4.1/

However, when I use Rstudio and type in the same command, i get a flood of error messages and the package doesn't install. In fact, it appears the files were downloaded, but then there are errors when unpacking the files. For example: "/Users/mynamehere/opt/anaconda3/bin/../include/c++/v1/wchar.h:133:77: error: use of undeclared identifier 'wcschr'
wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);}"

I'm using Rstudio Desktop v 1.1.456

Is there some problem due to having anaconda already installed? I can't seem to get Rstudio to extract packages to any other folder, even when typing install.packages("Synth",lib='~/Library/R/3.6/library') or any other directory. I don't need anaconda and happy to use Rstudio outside of it but it seems to have taken over

Most likely you are using the version that comes with the Anaconda distribution which is set to work with the Anaconda's R core and it makes installing packages from CRAN a nightmare. If you are going to keep this path I recommend you to install R packages using the Anaconda Navigator, however, RStudio is not officially supported through Anaconda so I would strongly recommend using a stand alone installation instead.

I actually tried downloading Rstudio separately, but whenever I open it, it seems to have anaconda automatically set as the default library. Do I need to uninstall anaconda to get a standalone Rstudio or somehow reset the settings for when I open the standalone version? Thank you!

Maybe it's being set on a startup file. You can change the default library folder by setting your R_LIBS_SITE environmental variable on a .Reviron or .Rprofile file.

For a more detailed explanation, you can read this blog post

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.