2

I have an R project held onto a Google Drive. I access both the R project and associated markdowns using the Google Drive desktop app. I recently updated my macOS to Monterey 12.2.1 and since then, I haven't been able to render plots inline within a markdown. I get the following error message when trying to print any plot:

Error in dev.off() :                                                                          
  QuartzBitmap_Output - unable to open file '/Volumes/GoogleDrive/Shared drives/.../.Rproj.user/shared/notebooks/-.../1/s/cqgw7b5dagxzw_t/_rs_chunk_plot_001.png'

This seems to be specific when opening a markdown, within an R project, onto a Google Drive. I have tried having a project on my local machine and opening the same markdown, plots display inline fine. I have tried opening the markdown outside of a project, again, can display plots inline fine. The plots also display in the viewer pane fine regardless and knitting is also not an issue.

The only clue I have is that when I go within the .Rproj.user directory, I can find a folder with the naming 'cqgw7b5dagxzw' (see path above), but it is missing the '_t'. Not sure what that could mean though.

Since updating the OS I have also reinstalled XQuartz.

I can still get to the plots, so it's not a HUGE issue, but the inline display feature is rather handy to make quick modifications to my visualisations.

Below are some session info.

Thanks!!!

PS: Plot twist! I can display plots inline with ggplotly?!?!

Workaround I found this workaround which displays the plots in the viewer pane instead. It is definitely an improvement, but displaying plots inline allows you to get an idea of the proportions of the plot you will eventually knit.

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.2.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8 
Raphael
  • 23
  • 4
  • That's a hard one to reproduce! I'm not very familiar with this package, but perhaps the [`googledrive` package](https://googledrive.tidyverse.org/index.html) could help? – Kat Feb 28 '22 at 05:28
  • Thanks Kat! I've used this package before to list files within my Google Drive, so I'll read over the documentation again, see if there's anything in it. I can imagine it would be a hard one to reproduce, it is such a specific case. I think on standard gmail accounts you get a bit of drive too, but then someone would have to have the desktop app too to access the files. – Raphael Feb 28 '22 at 08:21

1 Answers1

2

I found an issue someone logged on Rstudio github relates to this, linked here.

It seems you're right about the niche scenario of Rmarkdown + R Project + Google Drive + Inline plotting.

Someone in the comments suggested going to Preferences>General>Graphics and changing the back end option to Cairo instead of Quartz. Tried that on my end and seems to work when I tried a basic histogram with GGplot2. Not sure if using Cairo makes anything else worse though.

Using MacOS Monteray (12.3.1) if that helps.

Yev
  • 36
  • 3