webR-enabled code cells

Demo

webR-enabled code cell are established by using {webr-r} in a Quarto HTML document.


Sample cases

Fit a linear regression model


Create a graph with base R


Packages

Available Packages

You can view what packages are available for webR by either executing the following R code (either with WebR or just R):


Or, by navigating to the WebR repository:

https://github.com/r-wasm/webr-repo/blob/main/repo-packages

Installing a Package

Installing a package interactively is done using webr::install() inside of a {webr-r} code cell.

Note: Installing ggplot2 may take at least 2 minutes if COEP & COOP headers are not set.


Using a Package

Once ggplot2 is loaded, then use the package as normal.


Define variables and re-use them in later cells



Escape characters in a string


Anonymous function definition


Empty code cell


Prior code cell


Pre-rendered code cell

message("Hello!")
Hello!