R — Command Reference
R's most used commands — each with an explanation, working example, and real-world usage. The language of statistics, data analysis, and visualization.
7 categories · 15 commands
🖥️
Output
Printing to the screen and string concatenation.
cat()paste0() / paste()📦
Variables & Types
Assignment and type conversion.
<- (assignment)as.numeric() / as.integer()🔢
Numbers & Math
Operators and mathematical functions.
Math operatorssqrt() / abs() / round()✍️
Character
Length, casing, searching, and replacing.
nchar() / toupper()grepl() / gsub()📚
Vector
R's core data structure: 1-indexed vectors.
c() (vector)sum() / mean()🔀
Condition & Loop
if/else, for, and while.
if / elseforwhile🧩
Function
Definition and return with function.
functionSingle-line function