X & Y numeric vectors, F a factor or character vector, Ch a character vector, M a matrix or data frame, D is only a data frame, L a list, S an object with slots
X[ i ] | = | ith element of X |
X[ 1 : n ] | = | vector of elements 1 to n of X |
X[ c(2,3,5,6,11) ] | = | vector of elements nos 2,3,5,6,11 of X |
X[ Y <= 30] | = | vector of elements of X with indices matching the indices in Y that are less than 30 |
X[ F == "male" ] | = | vector of elements of X with indices matching the indices in F that are "male" |
M[ i , j ] | = | element in ith row and jth column |
M[ i , ] | = | vector of all elements in row i |
M[ , j ] | = | vector of all elements in column j |
M[ c(1,3), c(4,9,8) ] | = | 2 x 3 submatrix of M, consisting of row 1,3 and column 4,9,8 of M |
M[ , "colname"] | = | vector of column with name "colname" |
M[ , Ch] | = | matrix/data.frame of columns that have column names found in the vector Ch |
D$colname | = | vector of column with name "colname" |
D["colname"] | = | vector of column with name "colname" |
D[Ch] | = | data.frame of columns that have column names found in the vector Ch |
L[i] | = | list consisting of ith entry of L |
L[[ i ]] | = | ith entry in L |
L[ 1:n ] | = | list of entries 1 through n in L |
L["entryname"] | = | list consisting of the entry of L with name "entryname" |
L[["entryname"]] | = | entry of L with name "entryname" |
L$entryname | = | entry of L with name "entryname" |
L[Ch] | = | list of entries of L with names found in the vector Ch |
S@slotname | = | entry held under "slotname" in S |