Open dmurdoch opened 1 year ago
A workaround if you want collapse = TRUE
is to end any chunk at the point where it shows an rgl (or other htmlwidget) display, and start a new chunk afterwards. For example, change this:
```{r collapse = TRUE}
xyz <- matrix(rnorm(30), ncol = 3)
plot3d(xyz)
plot3d(xyz, type = "s")
to this:
xyz <- matrix(rnorm(30), ncol = 3)
plot3d(xyz)
plot3d(xyz, type = "s")
Another workaround is to use chunk option `fig.show = "hold"`, which will display all the `rgl` figures after the chunk, instead of showing them as they are completed. For example,
xyz <- matrix(rnorm(30), ncol = 3)
plot3d(xyz)
plot3d(xyz, type = "s")
If the chunk option has
collapse = TRUE
and any htmlwidget (including one from rgl) is displayed there, then code and output following the widget will not be formatted properly.Problematically, the
rmarkdown::html_vignette
template defaults tocollapse = TRUE
.This is a
knitr
issue, fixed in https://github.com/yihui/knitr/pull/2212. That fix is included inknitr
version 1.42.3, currently only on Github. You can install it with