R Beginner Flashcards
Addition: Subtraction: Multiplication: Division: Exponentiation: Modulo:
Addition: + Subtraction: - Multiplication: * Division: / Exponentiation: ^ Modulo: %% The modulo returns the remainder of the division of the number to the left by the number on its right, for example 5 modulo 3 or 5 %% 3 is 2.
assign a value 4 to a variable my_var
Error: non-numeric argument to binary operator
# Assign a value to the variable my_apples my_apples
numerics.
integers.
logical.
characters.
Decimal values like 4.5 are called numerics.
Whole numbers like 4 are called integers. Integers are also numerics.
Boolean values (TRUE or FALSE) are called logical.
Text (or string) values are called characters.
Note how the quotation marks in the editor indicate that “some text” is a string.
check the data type of a variable
# Declare variables of different types class(my_numeric)
What is a Vector
Vectors are one-dimension arrays that can hold
numeric data,
character data,
or logical data.
In other words, a vector is a simple tool to store data.
Naming a vector
Sum two vectors
Vector selection.
selecting items out of a vector
Vector selection.
selecting items 2 to 4
Vector selection:
using names
for less than for greater than for less than or equal to for greater than or equal to for equal to each other not equal to each other
< for less than > for greater than <= for less than or equal to >= for greater than or equal to == for equal to each other != not equal to each other