chunk <- "```"

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 chunk`{r echo = TRUE}
library(vitessceR)

vc <- VitessceConfig$new(schema_version = "1.0.16", name = "My config")

# configure vitessce here

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

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:



vitessce/vitessceR documentation built on Oct. 12, 2024, 12:24 a.m.