Reputation: 31
tl:dr Rmarkdown crashes when loading ggplot2 library in combination with using python chunks in Rstudio 1.4.1717
My Rmarkdown file is crashing after I upgraded to 1.4.something. It's the same ggplot2 crash people are talking about in other threads (e.g. ggplot Crashing system, GGplot crashes Rstudio after upgrade or suddenly geplot crashes). The fix to upgrade to 1.4.1717 does not resolve the issue for me.
If I use library(ggplot2) in the console it works, in a script or new markdown file it works. However, combined with using reticulate it crashes. Here's chunk 1
{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(reticulate)
library(dygraphs)
library(xts)
library(ggplot2)
library(lubridate)
library(scales)
library(ggpubr)
followed by chunk 2
{python ,echo=FALSE, message = FALSE, warning = FALSE,results = FALSE}
import os
path="/Users/-----"
os.chdir(path)
os.getcwd()
Chunk 1 works without any problem. However, as soon as I use import os
it crashes. If I disable the following packages #library(ggplot2) #library(ggpubr)
in chunk 1, then it does not crash. If I run chunk 2 before chunk 1 it crashes as soon as I load library(ggplot2)
.
I'm working with Miniconda (Python 3.6.13) as interpreter in Rstudio. Everything in the markdown works except for the combination of using ggplot2 (or ggpubr, but that's because it loads ggplot2) with any python chunk (i.e. I tried just using the following chunk #3
{python}
A=2
but this also crashed Rstudio. Any other people having similar issues? Is there any solution to this?
Upvotes: 0
Views: 117
Reputation: 31
Solved the problem. It was not Rstudio that needed an update, but I was running an old version of R itself. I am still not sure why the problem persisted on my new work computer and not on my backup computer with the same versions of R, Rstudio and python (reticulate) running, but updating R fixes the problem.
Upvotes: 1