1
votes

After updating to macOS 12.01 I am unable to generate any inline plots using ggplot in Rmd files that are stored in a Google Drive directory.

Any call to ggplot, e.g.

ggplot(iris, aes(x = Sepal.Length)) + 
  geom_bar(stat = "count")

Will fail with the error:

Error in dev.off() : 
  QuartzBitmap_Output - unable to open file '/Volumes/GoogleDrive/My Drive/.../.Rproj.user/shared/notebooks/-analysis/1/BB6A8C74064F89F4/cr5qmxwe04yxu_t/_rs_chunk_plot_001.png'

Executing this code in the console works fine, and I can knit the Rmd without errors. Changing the graphics backend to Cairo also fixes this, so it seems likely to be an issue with Quartz.

Moving the project file to a local directory also resolves this, but previous to macOS 12.01, R project integration with Google Drive would not cause these issues.

Xcode, XQuartz, R, and RStudio are all up to date.

Please provide enough code so others can better understand or reproduce the problem.Community
OP, this is definitely an issue with your Google Drive. R and R Studio generally do not play very well when the libraries or projects are loaded from a shared drive. Sometimes it works for me, sometimes not. In the end, I use OneDrive / Google Drive to backup project files, but for the working environment, I don't work off anything that is synced. I recommend the same for you.chemdork123