Skip to contents

Pkgdown is an R package designed to build documentation websites for R packages. However, it can also be an easy way to create a static website using R.

The Vitessce widget can be embedded in a static website built with pkgdown. In fact, this documentation website was built with pkgdown, and both of the remote data examples (Usage with JSON: Remote Example and Usage with OME-TIFF: Remote Example) take advantage of the ability to render R htmlwidgets into a pkgdown website.

To render a Vitessce widget into a pkgdown article, set the chunk options at the top of the code block such that output is rendered, and execute the widget function in the final line of the code block.

```{r echo = TRUE}
library(vitessceR)

vc <- VitessceConfig$new("My config")

# configure vitessce here

vc$widget(theme = "light", width = "100%")
```

Note that because pkgdown sites are static, pkgdown cannot be used to serve data to Vitessce, so only remote datasets (with files added via the dataset$add_file method) can be used on pkgdown sites.

The full code for the two examples linked above can be explored on GitHub: