I'm developing some R packages and noticed some really strange behavior. I'm not using any virtual environment per package, so each package should have access to the same installed libraries. However,
there are different possible library paths where R might look for packages: So generally, when I run .libPaths() inside an opened package, I get the following output:
This leads to import errors as R is not able to find the libraries that are stored within /usr/local/lib/R/site-library. I really don't get it why the output of libPaths gives two different results, as the package structure of the two packages is identical. Furthermore, in my understanding libPath is s.th. that is set globally and not per project, at least of no renv is used, right?
I'm working with R 4.2.1 on Posit Workbench 2023.03.1+446.pro1, “Cherry Blossom”.
So when I simply start a new session, no project is selected e.g.
In this case,
With opening a package I mean that I have a running session with a opened project, so that the GUI shows s.th. like this:The project itself is a R package (No Shiny), with the following structure
That is very weird indeed, and probably specific to RStudio, so it would be a good idea to add the RStudio IDE tag to this post, so the right people see it.
I did a quick search, and did not find any (open or closed) issues about this in the issue tracker at Issues · rstudio/rstudio · GitHub so if you don't get a solution here, consider opening an issue there.
FWIW I cannot reproduce this on macOS with RStudio 2023.09.1+494, but I also don't see anything in my project or global settings that could influence this.
Seems like you have an empty .RData file, maybe try removing that, but this is really just a shot in the dark.