XCODX |

R Online Compiler & Interpreter

Select Language
Online Code Compiler
Full HTML IDE
Py main.py
Program Output Ready
  Welcome to XCODX Online Compiler

  Quick Start:
  Ctrl+Enter  Run code
  Ctrl+S      Save / Download
  Ctrl+L      Clear output

  Select a language and start coding.
Success
Operation completed

About R

R was built by statisticians for statisticians, and it shows in the best way: vectors, data frames, and model fitting are native concepts, not imports. Descended from Bell Labs' S language and now stewarded by the R Core Team (the 4.4/4.5 release line is current), R dominates academic statistics, biostatistics, and epidemiology, and is entrenched in pharmaceutical submissions — the FDA accepts R-based analyses, and CRAN hosts over 20,000 peer-contributed packages. Universities across the US, UK, and Australia teach introductory statistics directly in R. This page executes R scripts in a live terminal session, streaming console output as it computes and accepting typed input mid-run, so you can work through problem sets with zero installation.

Hello World in R

con <- file("stdin", "r")

cat("What is your name? ")
name <- readLines(con, n = 1)
cat("Hi,", name, "- let's summarize some data.\n")

cat("Enter numbers separated by spaces: ")
values <- scan(con, what = numeric(), nlines = 1, quiet = TRUE)

cat("n      :", length(values), "\n")
cat("Mean   :", mean(values), "\n")
cat("Median :", median(values), "\n")
cat("SD     :", sd(values), "\n")
cat("Z-scores:", round((values - mean(values)) / sd(values), 2), "\n")

close(con)

When to use R

R is the default language of university statistics: intro stats, econometrics, psychology research methods, and biostatistics courses all assign R exercises, and this page handles the classic homework patterns — summary statistics, distributions with rnorm/pbinom, t.test, and lm for regression — without requiring RStudio on a lab machine or Chromebook. It is equally handy for data analysts who want to sanity-check a formula or verify how a function handles NA values before running it on real data. Base R's built-in datasets (mtcars, iris) make self-contained practice easy.

Common questions

Can an R script read my typed input on this page?

Yes. Reading from file("stdin") with readLines or scan pauses the script until you type into the terminal, and cat output appears the moment it is produced. That makes interactive exercises work naturally — prompt for values, compute, prompt again — much like a console session in RStudio.

Which R version runs here, and is it full R?

Scripts execute with Rscript on a modern R 4.x build — the complete standard interpreter, not a subset. Everything in base R plus the bundled recommended layer of functionality (statistics, matrix algebra, apply-family functions, built-in datasets) behaves exactly as it would in a local installation.

Can I use ggplot2, dplyr, or other CRAN packages?

No — install.packages() is not available in the sandbox, so tidyverse packages will not load. Base R covers a surprising amount of coursework, though: aggregate, tapply, and merge replace much of dplyr, and plotting exercises can be reworked as numeric output. For package-heavy projects, prototype the logic here and run the full version locally.

How R runs on XCODX

Sandbox filename
main.r
Entry point
single main source file
Editor grammar
r
Reading stdin
readLines("stdin")
Input delivery
live WebSocket stream
Prompt flushing
flush manually before reading input
Compile limit
10 s
Run limit
3 s batch · up to 3 min live
Memory
256 MB per stage
Max source
50,000 characters

Default program on this page

cat("Hello from R!\n")
cat("Welcome to XCODX Online Compiler!\n")
numbers <- c(1, 2, 3, 4, 5)
cat("Sum:", sum(numbers), "\n")