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.
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.
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.
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)
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.
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.
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.
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.
main.rrreadLines("stdin")cat("Hello from R!\n")
cat("Welcome to XCODX Online Compiler!\n")
numbers <- c(1, 2, 3, 4, 5)
cat("Sum:", sum(numbers), "\n")