R Playground
Run a local base-R subset and see plots.
Input
1 line · 19 charsResult
2 lines · 95 charsR Playground is a lightweight base-R preview, not a real R runtime: no webR, no interpreter download and no package system. It deterministically evaluates a documented subset locally — vector assignment (x <- c(1, 2, 3)), ranges like 1:200000, the mtcars$mpg sample column, mean/sum/length/max/min, summary() with R's type-7 quantiles, and hist/plot/barplot rendered as inline charts. Statements outside this subset (lm, rnorm, print, ggplot2, packages) are reported as explicit errors instead of being approximated, so results are never misleading. Nothing is uploaded, stored in the URL, or sent anywhere.
Examples
summary(lm(mpg ~ wt, data=mtcars))Call: lm(formula = mpg ~ wt, data = mtcars) ...Model summaries print in the console exactly as they do in desktop R.
hist(rnorm(1000))plot 1: histogramEach flushed plot becomes a numbered card in the plots gallery.
x <- 1:10
mean(x)5.5Assignments persist between runs until you reset the environment.
About this tool
webR is a genuine R runtime compiled to WebAssembly. This playground wraps it with a script editor, a console pane, a plots gallery and an environment table, so quick statistics experiments need no local installation.
Plotting is the differentiator: base graphics calls such as plot(), hist() and barplot() are captured from a canvas device and shown as numbered images you can download. Several plots stack in the gallery and persist for the session.
The runtime is heavy — roughly 30 MB on first load — and the tool says so before downloading. After caching, snippet evaluation is fast. A soft timeout offers to terminate and restart the runtime for runaway code, with the resulting state loss disclosed.
What this tool does not do
- Package installation is not a full CRAN experience; v1 focuses on base R and a small preloaded set.
- A runaway loop cannot be cleanly interrupted mid-WASM; recovery requires a runtime restart.
- Plots are stored for the session only unless you opt into local persistence.
How to use this tool
Wait for the runtime
On first visit the webR assets download with a progress chip. The size is disclosed; cached visits start faster.
Write a script
Type R code or load one of the example chips. Assignments you make are kept for subsequent runs.
Run and inspect
Press Run to evaluate. Console text appears in the console tab and plots are appended to the gallery.
Reset or stop
Reset re-initializes the R environment. For a runaway computation, terminate and restart the runtime after the soft timeout.
Use cases
Statistics coursework
Run homework snippets and base-R plots without installing R on a school machine.
Quick analysis
Test a data.frame transformation or linear model on built-in datasets while away from your work station.
Teaching
Share a runnable R snippet with students who have no local R installation.
Panels
| Panel | Contents |
|---|---|
| Console | stdout, warnings, errors |
| Plots | Canvas-captured base graphics |
| Environment | ls() names with class and dims |
| Problems | Parse and runtime errors |
The hidden introspection call used for the environment table never appears in your console.
Common mistakes
Mistake:Expecting ggplot2 to work out of the box.
Fix:The first load ships base R and a small preloaded set. Installing additional packages is limited and slow in webR, so base graphics are the supported plotting path.
Mistake:Assuming Stop can interrupt any computation.
Fix:webR evaluation is cooperative. After the soft timeout the only reliable recovery is terminating and restarting the runtime, which loses the current environment.
Mistake:Forgetting the first-load size.
Fix:R and its WASM runtime are around 30 MB. The tool discloses the size and progress; HTTP caching makes later imports much faster.
Frequently asked questions
Which R version does it run?
webR runs a real R interpreter compiled to WebAssembly; the exact version is pinned with the runtime assets and displayed in the status area once boot completes.
Can I install ggplot2?
The playground focuses on base R and a small preloaded package set. webR has an install path for additional packages, but it is slow and not every package is WebAssembly-ready, so base graphics are the reliable plotting route here.
Why is the first load about 30 MB?
That is the R interpreter and its supporting libraries compiled to WebAssembly. The tool discloses the size before downloading and relies on HTTP caching so subsequent visits load much faster.
Are plots saved?
Plots are kept in the gallery for the current session and can be downloaded as PNG images. Persistent storage is opt-in and stored only in your browser.
Does it keep variables between runs?
Yes. The R environment persists across runs, so assignments made in one script are available in the next. Use Reset when you want a fresh environment.
References & standards
Related tools
AssemblyScript Playground
Write AssemblyScript-style functions, inspect a module preview, and run exports with a step-bounded offline evaluator.
Bash Playground
Test bash script snippets in a local mini-shell with seeded files, stdin, stream tags and visible sandbox limits.
C & C++ Playground
Check C and small C++ source for structural problems, map findings to lines and see the compile command for a local toolchain.
C# Playground & Snippet Checker
Static pre-flight checks for C# snippets — diagnostics, detected features and metrics, entirely in-browser.
Dart Playground
Write Dart, press Run, and see print output in your browser.
DBML Playground
Write DBML and see an ER diagram plus SQL DDL for Postgres, MySQL, SQLite and MSSQL, all in your browser.