Slicing and extracting data Flashcards Preview

R > Slicing and extracting data > Flashcards

Flashcards in Slicing and extracting data Deck (20)
Loading flashcards...
1

x[n]

nth element

2

x[-n]

all but the nth element

3

x[1:n]

first n elements

4

x[-(1:n)]

elements from n+1 to the end

5

x[c(1,4,2)]

specific elements

6

x["name"]

element named "name"

7

x[x>3]

all elements greater than 3

8

x[x > 3 & x < 5]

all elements between 3 and 5

9

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

elements in the given set

10

LIST: x[n]

list with elements n

11

x[[n]]

nth element of a list

12

LIST: x[["name"]]

element of the list named "name"

13

LIST: x$name

id

14

x[i, j]

element at row i, column j

15

x[i,]

row i

16

x[,j]

column j

17

x[,c(1,3)]

columns 1 and 3

18

x[name,]

row named "name"

19

DATAFRAME: x[["name"]]

column named "name"

20

DATAFRAME: x$name

id