Slicing and extracting data Flashcards

1
Q

x[n]

A

nth element

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

x[-n]

A

all but the nth element

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

x[1:n]

A

first n elements

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

x[-(1:n)]

A

elements from n+1 to the end

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

x[c(1,4,2)]

A

specific elements

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

x[“name”]

A

element named “name”

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

x[x>3]

A

all elements greater than 3

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

x[x > 3 & x < 5]

A

all elements between 3 and 5

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

x[x %in% c(“a”,”and”,”the”)]

A

elements in the given set

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

LIST: x[n]

A

list with elements n

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

x[[n]]

A

nth element of a list

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

LIST: x[[“name”]]

A

element of the list named “name”

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

LIST: x$name

A

id

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

x[i, j]

A

element at row i, column j

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

x[i,]

A

row i

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

x[,j]

A

column j

17
Q

x[,c(1,3)]

A

columns 1 and 3

18
Q

x[name,]

A

row named “name”

19
Q

DATAFRAME: x[[“name”]]

A

column named “name”

20
Q

DATAFRAME: x$name

A

id