I am trying to print a base R plot in Quarto while saving it to a variable to save it as an image later. The problem is that I get an error when using recordPlot()
.
---
title: "Repro"
format: html
---
```{r}
# Create a basic plot
curve(dnorm, from=-5, to=+5)
# Save the plot
test <- recordPlot()
# Recreate the plot
replayPlot(test)
```
returns
Error in recordPlot() : no current device to record from
What am I doing wrong?
Thank you