R
v4.1.1
R
v4.1.1
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.
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)Yes. CompileBytes runs your R scripts in the browser with no need to install R or RStudio locally.
This compiler runs R 4.1.1, so base functions and syntax available up to that release are supported.
Use readLines("stdin", n = 1) to read a line from standard input. Enter your text in the input/stdin panel before running.
Yes, running R on CompileBytes is completely free with no account required.
The online environment provides base R; third-party CRAN packages that need separate installation may not be available in the sandbox.