Hello, World!
cat("Hello, World!\n")Tap Run to execute
main.R · output appears here
Press Run to execute
Output streams here as your program runs.
R is a language and environment for statistical computing and graphics, created by Ross Ihaka and Robert Gentleman at the University of Auckland, with its first release in the mid-1990s. It is an open-source implementation inspired by the S language, featuring vectorized operations, a rich set of statistical functions, and powerful data visualization capabilities.
R is widely used by statisticians, data scientists, and researchers for data analysis, statistical modeling, machine learning, and producing publication-quality graphics. Its extensive package ecosystem on CRAN, along with frameworks like the tidyverse and ggplot2, makes it a leading tool in academia, bioinformatics, finance, and data science.
main.R is the entry point for each run.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
cat("Hello, World!\n")cat("Enter your name: ")
name <- readLines("stdin", n = 1)
cat("Hello,", name, "\n")fruits <- c("apple", "banana", "cherry")
for (i in seq_along(fruits)) {
cat(i, ":", fruits[i], "\n")
}factorial <- function(n) {
if (n <= 1) return(1)
n * factorial(n - 1)
}
print(factorial(5))result <- tryCatch(
as.integer("abc") + 1,
warning = function(w) {
cat("Warning:", conditionMessage(w), "\n")
NA
}
)
print(result)text <- strsplit("banana", "")[[1]]
counts <- table(text)
print(counts)nums <- c(3, 1, 4, 1, 5)
cat("Sorted:", sort(nums), "\n")
doubled <- sapply(nums, function(x) x * 2)
print(doubled)df <- data.frame(
name = c("Ada", "Bob"),
age = c(36, 28)
)
print(df)
cat("Mean age:", mean(df$age), "\n")v <- 1:10
squares <- v^2
cat("Squares:", squares, "\n")
cat("Even values:", v[v %% 2 == 0], "\n")df <- data.frame(
name = c("Ada", "Bob", "Cy"),
age = c(36, 28, 41)
)
adults <- df[df$age > 30, ]
print(adults)The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Type or paste your code into the editor, then click Run (or press Ctrl/Cmd + Enter) to execute it.
Output streams into the console panel, including runtime errors, exit status, and execution time.
Nothing to install and no account to create — code runs in an isolated hosted runtime.
Language-aware autocomplete and IntelliSense suggestions where the editor has a matching language service
Syntax highlighting, with native compiler and runtime errors shown in the console
Bracket matching, auto-indentation, code folding, and a minimap
Multi-cursor editing plus find & replace (Ctrl/Cmd + F)
Full undo/redo history and copy to clipboard
Built on Monaco — the same editor that powers VS Code
Run on demand, or turn on Auto-run to execute on every change
Stop long-running or infinite programs at any time
A real console shows standard output, errors, exit status, and execution time
Pass standard input (stdin) to your program from the Input panel — one value per line
Switch between light and dark themes
Adjust font size and other editor settings
Toggle side-by-side or top/bottom layouts
Enter distraction-free fullscreen mode
Generate a shareable link to your exact code in one click — no login needed
Your work autosaves to your browser, so you can pick up where you left off
Copy the active file to your clipboard
Run code: Ctrl/Cmd + Enter
Find & replace: Ctrl/Cmd + F
Open the full shortcut list from the keyboard icon in the toolbar
R is one of 46 single-file compiler scratchpads. Each run submits only main.R; local sibling-file imports are not enabled.
Linked-project languages (23): Node.js, TypeScript, Deno, Python, C, Go, Dart, Swift, Rust, Ruby, PHP, Java, Kotlin, C++, C#, Nim, Crystal, Haxe, Zig, Scala, D, Bun, Objective-C.
Single-file scratchpads (46): Matplotlib, NumPy, pandas, Haskell, Clojure, Perl, Lua, Tcl, jq, Raku, Elixir, Bash, Zsh, Nushell, R, Assembly (NASM), Julia, Octave, Groovy, PowerShell, Visual Basic .NET, Odin, Pascal, Lisp, Erlang, CoffeeScript, COBOL, BASIC, V, Racket, OCaml, Prolog, AWK, Emacs Lisp, Emojicode, Forth, F#, Fortran, Assembly (NASM64), Solidity, Mojo, Ada, WASM (WAT), Gleam, Shell Script (sh), Scheme.
Download file exports the active R source file.