Home / Playground / R

Run R online in your browser

Write and run R right here: data frames, statistics, base graphics and ggplot2 (installed automatically the first time). Load a sample dataset, inspect your variables, and export your work as a notebook. R runs in your browser through webR.

Ctrl/⌘ + Enter: run · Shift + Enter: run cell · Ctrl/⌘ + /: comment · Esc: leave the editor

What you can do here

How it works

R runs in your browser using webR, R compiled to WebAssembly. The first run downloads it (about 20 MB, plus any packages you load) and your browser keeps it. Your code and data stay on your device.

Limits

Packages must be built for webR (most popular CRAN packages are). readline() cannot wait for typing in the browser, and code cannot reach the internet. Stop restarts R, which clears your variables.

Examples

ExampleWhat it shows
Hello, RVectors, a function and paste().
Average order value by countrymerge() and aggregate() in base R.
Join orders to customersmerge() joins two data frames on a key.
Top 5 products by revenueaggregate, sort, head.
Finding and handling missing valuesis.na(), colSums() and filling with the median.
Monthly revenue chartA base-R bar chart.
A ggplot2 chartggplot2 installs automatically the first time (it takes a moment).
Predict house pricesA linear model with lm() and its summary.
Do SMS reminders matter?A two-sample comparison: t.test() and a proportion test.
Cluster flowers with k-meansR's built-in iris data, kmeans() and a plot.
Running total per customercumsum() within groups using ave().
Notebook mode: cellsLines starting with # %% split the code into cells; Shift+Enter runs one cell.

Learn more

Comparing languages? Most examples here have the same task in Python and SQL: use "Same task in" under the editor.

Questions

Is this R compiler free?

Yes, with no sign-up. R runs in your browser through webR.

Does ggplot2 work online?

Yes. The first library(ggplot2) installs it, which takes a little while; after that it loads quickly.

Which R version is it?

webR 0.5, which runs R 4.5.

Can I install other packages?

Most popular CRAN packages are built for webR and install when you call library().