1. Introduction Flashcards

1
Q

Arithmetic operators

A

Parentheses: (5 / 5) + 5

Multiplication: 5 * 5

Division: 5 / 5

Addition: 5 + 5

Subtraction: 5 - 5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Variable operations

A

Assigning a value to a variable:

value_1 <- 50 value_2 <- 5

Assigning the result of a calculation to a variable:

total <- 5 + 5 average <- (5 + 5 + 5) / 3

Performing calculations using variable names:

value_1 + value_2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Vector operations

A

Create a vector of values:

vector_1 <- c(50, 5)

Create a vector using variable names

vector_1 <- c(value_1, value_2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Built-in functions

A

Average of values in a vector: mean(vector_1)

Smallest value in a vector: min(vector_1)

Largest value in a vector: max(vector_1)

Total number of elements in a vector: length(vector_1)

Sum of elements in a vector: sum(vector_1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Concepts

A

R uses the order of operations rules from mathematics when evaluating expressions.

There are some rules you need to follow when naming variables in R:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly