1 Flashcards

1
Q

x %% y = ?

A

Modulo (remainder)

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

x %/% y = ?

A

Integer Addition (quotient)

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

How to make an R vector?

A

c(x,y,z)

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

How to create an R vector by using a range?

A

x:y

E.g., var <- x:y

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

How to create a vector using a range at specified increments?

A

seq(from=x, to= y, by=z)

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

How to create an R vector with a certain number of increments yet hitting the max value?

A

seq(from = x, to = y, length = z)

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

How to replicate a vector in R?

A

rep(vector, times = x)

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

How to merge vectors in R?

A

Create vectors as vars, and then assign them to a new vector as c().

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

How to turn vectors into arrays?

A

var = 1:4
var[]

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

How to remove indexes from arrays in R?

A

array[-x]

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

How to record how many elements are in a vector in R?

A

length(vector)

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

How to extract unique (eliminating repeated elements) elements in a vector in R?
E.g., (1,2,2,3,2,3,4) -> (1,2,3,4)

A

unique(vector)

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

How to determine how many times an element appears in a vector in R?

A

table(vector)

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

How to extract the title names of a table in R?

A

names(table(vector))

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

How to extract the values from a table in R?

A

table(vector)[index]

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