I’m trying to render a quarto document with a gganimate gif inside.
The simple test file I have contains only the following:
---
title: "gganimate test"
---
```{r}
library(ggplot2)
library(gganimate)
df <- data.frame(time = seq_len(10),
y = runif(10))
ggplot(df,aes(x=time,y=y)) +
geom_point() +
transition_states(time)
``` # (I had to include a slash here to show the back ticks)
When I try to render this file, I get the following error:
processing file: test.qmd
|....................................................| 100% [unnamed-chunk-1]Error in `file()`:
! cannot open the connection
Backtrace:
1. global .main()
2. execute(...)
3. rmarkdown::render(...)
4. knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
5. knitr:::process_file(text, output)
...
27. gganimate:::animate.gganim(...)
28. args$renderer(frames_vars$frame_source, args$fps)
29. gganimate:::png_dim(frames[1])
30. base::readBin(file, n = 24L, what = "raw")
31. base::file(con, "rb")
Quitting from lines 6-17 [unnamed-chunk-1] (test.qmd)
Execution halted
I’ve tried saving the file in a different drive, and the animation works when simply run within the R console. The document also renders when I take the animation out (i.e. remove the transition_states()
line).
Any help appreciated.