General variable assignment
Variables names: The variable name must start with a letter and can contain numbers and letters as well as the special characters underscore and period. Note: Contrary to other languages R does not have a command for declaring a variable, but instead a variable is created once a value is assigned to it. Arithmetic operators
Arithmetic operators: Used to perform common mathematical operations. Precedence: Precedence and associativity are as normal as in maths. Access variables of a dataframe
|
Some misc commands
Internal help option: Writing ? in front of the command opens R documentation of the command. Vector creation and assignment
Vector: A vector is a 1D set of the same type of object. Most often, a vector will simply be a sequence of numbers. Note: Similarly to variables, a vector is created once a value is assigned to it. |
Comments
Comments: Comments are ignored by the computer, they exist simply to make the code easier for people to understand. Indexing vectors
Note: The indexing is 1-based so it starts at 1 instead of 0 like most other programming languages do. Basic math functions
|
Cheatography
https://cheatography.com
R - Beginner Syntax Cheat Sheet (DRAFT) by soleille01
A summary of all the R programming language syntax I have learned so far. Still learning; I'll be back now and then
This is a draft cheat sheet. It is a work in progress and is not finished yet.