PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

R

R

R is a programming language created in 1993 by Ross Ihaka.

R is an open source programming language and software environment for statistical computing and graphics that is supported by the R Foundation for Statistical Computing. The R language is widely used among statisticians and data miners for developing statistical software and data analysis. Polls, surveys of data miners, and studies of scholarly literature databases show that R's popularity has increased substantially in recent years. Read more on Wikipedia...

Try now: Riju ยท TIO

#11on PLDB 29Years Old 1.1mUsers

Example code from Riju:

print("Hello, world!")

Example code from hello-world:

cat("Hello World")

Example code from the Hello World Collection:

# Hello World in R cat("Hello world\n")

Example code from Linguist:

hello <- function() { print("hello, world!") } hello()

Example code from Wikipedia:

install.packages("caTools") # install external package library(caTools) # external package providing write.gif function jet.colors <- colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000")) dx <- 400 # define width dy <- 400 # define height C <- complex( real=rep(seq(-2.2, 1.0, length.out=dx), each=dy ), imag=rep(seq(-1.2, 1.2, length.out=dy), dx ) ) C <- matrix(C,dy,dx) # reshape as square matrix of complex numbers Z <- 0 # initialize Z to zero X <- array(0, c(dy,dx,20)) # initialize output 3D array for (k in 1:20) { # loop with 20 iterations Z <- Z^2+C # the central difference equation X[,,k] <- exp(-abs(Z)) # capture results } write.gif(X, "Mandelbrot.gif", col=jet.colors, delay=100)

Keywords in R

if else repeat while function for in next break TRUE FALSE NULL Inf NaN NA NA_integer_ NA_real_ NA_complex_ NA_character_ ...

Language features

Feature Supported Example Token
Conditionals โœ“
Functions โœ“
While Loops โœ“
Booleans โœ“ TRUE FALSE
Assignment โœ“ =
Print() Debugging โœ“ print
Line Comments โœ“
# A comment
#
Pipes โœ“
# R has pipes via a library like dplyr
starwars %>% filter(species == "Droid")
Operator Overloading โœ“
Lazy Evaluation โœ“
File Imports โœ“
source("filename.r")
Comments โœ“
# A comment
Bitwise Operators โœ“
! x
x & y
x && y
x | y
x || y
xor(x, y)
Strings โœ“
"hello world"
"
Semantic Indentation ฯด
MultiLine Comments ฯด

Trending R repos on GitHub

repo stars description
bookdown 1586 Authoring Books and Technical Documents with R Markdown
r4ds 2051 R for data science: a book
tidytuesday 1062 Official repo for the #tidytuesday project
shiny 3527 Easy interactive web applications with R
rmarkdown 1596 Dynamic Documents for R
swirl_courses 3009 ๐ŸŽ“ A collection of interactive courses for the swirl R package.
rnaseq_tutorial 767 "Informatics for RNA-seq: A web resource for analysis on the cloud. Educational tutorials and working pipelines for RNA-seq analysis including an introduction to: cloud computing critical file formats reference genomes gene annotation expression differential expression alternative splicing data visualization and interpretation."
seurat 540 R toolkit for single cell genomics

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements ยท Email ยท GitHub