coatless / quarto-webr

Community developed Quarto Extension to Embed webR for HTML Documents, RevealJS, Websites, Blogs, and Books.
https://quarto-webr.thecoatlessprofessor.com/
394 stars 19 forks source link
blog book html quarto quarto-extension r-programming revealjs rstats webassembly webr website

webR Extension for Quarto

[!IMPORTANT]

Looking for the official Quarto WebAssembly backend? Check out quarto-live!

This community developed Quarto extension enables the webR code cell within various Quarto formats, including HTML, RevealJS, Websites, Blogs, and Books.

`quarto-webr` Filter in Action

Take a look at a live example of the extension in action here! To delve deeper into the extension's capabilities, see our comprehensive documentation website.

Looking for a Python version? Check out quarto-pyodide!

[!NOTE] Please note that the {quarto-webr} Quarto extension is a community-driven initiative and is not affiliated with Posit, Quarto, or the main webR project. Its evolution and maintenance stem solely from the collective efforts of community members.

Background

If you're new to webR, this cutting-edge technology empowers you to:

"run R code in the browser without the need for an R server to execute the code."

For a deeper understanding of webR, explore the following resources:

Quick Start Video Guide

For those new to Quarto and Quarto Extensions, we highly recommend checking out this informative YouTube video to get started quickly:

Creating your first webR-powered Quarto Document inside of RStudio

Installation

To use this extension in a Quarto project, install it from within the project's working directory by typing into Terminal:

quarto add coatless/quarto-webr

Demonstration of using the Terminal tab to install the extension.

After the installation process is finished, the extension will be readily available for Quarto documents within the designated working directory. Please note that if you are working on projects located in different directories, you will need to repeat this installation step for each of those directories.

Usage

For each document, place the webr filter in the document's header:

filters:
  - webr

Then, place the R code for webR in a code block marked with {webr-r}

---
title: webR in Quarto HTML Documents
format: html
engine: knitr
filters:
  - webr
---

This is a webR-enabled code cell in a Quarto HTML document.

```{webr-r}
fit = lm(mpg ~ am, data = mtcars)

summary(fit)


The rendered document can be viewed online [here](https://quarto-webr.thecoatlessprofessor.com/examples/readme).

 **Note:** If you don't specify the `engine: knitr`, the default compute engine used will be `jupyter`. This could trigger prompts to install Python. However, if you specify `engine: knitr`, there's no need to install Python.

There are many more customization options that are available. Please see the [customization documentation](https://quarto-webr.thecoatlessprofessor.com/qwebr-meta-options.html) for more examples.

For specific deployment usage cases, please see [Templates](https://quarto-webr.thecoatlessprofessor.com/qwebr-deployment-templates.html). 

## Help

For troubleshooting help, please see our [troubleshooting page](https://quarto-webr.thecoatlessprofessor.com/qwebr-troubleshooting.html).

To report a bug, please [add an issue](https://github.com/coatless/quarto-webr/issues/new) to the repository's [bug tracker](https://github.com/coatless/quarto-webr/issues).

Want to contribute a feature? Please open an issue ticket to discuss the feature before sending a pull request. 

## Acknowledgements

Please see our [acknowledgements page](https://quarto-webr.thecoatlessprofessor.com/qwebr-acknowledgements.html).