Basics Flashcards
1
Q
Assigning values
A
- x = ?
- x
2
Q
Creating Vectors
A
- x = c(?, ?, ?, ?,?)
- x = c(“?”, “?”)
3
Q
Sequencing
A
- x:y
- seq(from=x, to=y, by=?)
4
Q
Repeating
A
- rep(x, times=?)
- rep(“?”, times=?)
5
Q
Extracting from a vector
A
E.g. if: y = c(1, 3, 5, 7, 9) then: y[3] would extract the third number = 5 if: y = c(1, 3, 5, 7, 9) then y[-3] would extract everything but the third number = 1 3 7 9
6
Q
Constructing a matrix
A
matrix(c(?,?,?,?,?,?), nrow=?, byrow=TRUE/FALSE)
7
Q
Extracting from a matrix
A
?