Demo: Custom R WASM Package Repository

Overview

In this example, we add a custom R WASM Package repository that contains demorwasmbinary R WASM package. The package is not available from the main webR repository.

The source of the custom repository can be viewed here and the rendered website using {pkgdown} can be viewed here. Another approach would be to use r-universe.dev to automatically build and supply R WASM package binaries.

Specify repos key

To automatically have the package installed and loaded like normal, please specify the name of the package in packages and where the custom repository is in repos.

For this example, we would specify:

---
webr:
  packages: ['demorwasmbinary']
  repos:
    - https://tutorials.thecoatlessprofessor.com/webr-unified-gh-workflow/
---
Note

This version will ensure that any webr-r code cells inside of the document are not run prior to the package being present.

Specify repos in webr::install()

Alternatively, we can avoid registering a repository and directly install from a custom repository by using webr::install(pkg, repos = "...").

For example, we can re-create the above statement using:

```{webr-r}
# context: setup
# Install the binary from a custom repository
webr::install(
  "demorwasmbinary", 
  repos = "https://tutorials.thecoatlessprofessor.com/webr-unified-gh-workflow/"
)

library("demorwasmbinary")
```

Explore the package

Finally, let’s use the package within a regular webR code cell, e.g.

Important

This Quarto extension is open source software and is not affiliated with Posit, Quarto, or webR. The extension is at best a community effort to simplify the integration of webR inside of Quarto generated documents.