Lesson 3 Flashcards

1
Q

Creating a basic sequence of numbers e.g. 1-15

A

x < - 1:15

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

Sequence function

A

seq(x)

e.g. seq(from=x, to=y)

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

Creating a sequence with numbers incremented by a certain value

A

seq(x, y, by=z)

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

Creating a sequence of X numbers between Y and Z

A

seq(y, z, length=x)

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

Generating a sequence of numbers the length of an already created vector

A

1:length(vectorX)

seq(along.with = vectorX)

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

Replicate function

A

rep(x)

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

Getting rid of all values greater or equal to X in vectorY (indexing)

A

vectorY < - vectorY [vectorY < X]

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

Getting rid of certain values within a vector

A

vector < - vector [-c(x, y)]

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

Creating a list

A

list(x)

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

Getting the X element of the Y vector inside a list

A

list [[Y]] [X]

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

Naming vectors inside a list

A

names(list) < - c(“vector1”, “vector2”…)

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

Indexing a named vector

A

list $ vectorX [y]

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

Creating a data frame

A

data.frame(vectorX, vectorY, vectorZ…)

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

Printing elements inside a data frame

A

df [rowX, colY]

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