Show Menu
Cheatography
This is a draft cheat sheet. It is a work in progress and is not finished yet.

Arithmetic

+
Addition
-
Subtra­ction
*
Multip­lic­ation
/
Division
^
Expone­nti­ation
%%
Modulo

Variable Assignment

my_var <- 4
To store a value (e.g. 4) or an object (e.g. a function descri­ption) in R then later use this variable's name to easily access the value or the object that is stored within this variable.

Basic Data Types

Numerics
Decimals values like 4.5 and 4
Integers
Natural numbers like 4
Logical
Boolean values (TRUE or FALSE)
Characters
Text (or string) values
class()
To check the data type of a variable
 

Selection by Comparison

<
Less than
>
Greater than
<=
Less than or Equal to
>=
Greater than or Equal to
==
Equal to each other
!=
Not equal to each other

Vectors

Vectors are one-di­mension arrays that can hold numeric data, character data, or logical data.
In other words, a vector is a simple tool to store data.

Vector Functions

c()
Create a vector
names()
Give a name to the elements of a vector
sum()
Calculates the sum of all elements of a vector
[]
Select specific elements of a vector
[c( , )] OR [c( : )]
Select multiple elements from a vector