x[n]
nth element
x[-n]
all but the nth element
x[1:n]
first n elements
x[-(1:n)]
elements from n+1 to the end
x[c(1,4,2)]
specific elements
x[“name”]
element named “name”
x[x>3]
all elements greater than 3
x[x > 3 & x < 5]
all elements between 3 and 5
x[x %in% c(“a”,”and”,”the”)]
elements in the given set
LIST: x[n]
list with elements n
x[[n]]
nth element of a list
LIST: x[[“name”]]
element of the list named “name”
LIST: x$name
id
x[i, j]
element at row i, column j
x[i,]
row i
x[,j]
column j
x[,c(1,3)]
columns 1 and 3
x[name,]
row named “name”
DATAFRAME: x[[“name”]]
column named “name”
DATAFRAME: x$name
id