[[.mlth.data.frame | R Documentation |
The methods to extract parts of a multi-headed data frame.
Work the same way as the data.frame
. The [<-
and [[<-
are to be implemented.
## S3 method for class 'mlth.data.frame'
x[[i]]
## S3 method for class 'mlth.data.frame'
object$name
namesList(x)
selectByList(x, N)
x, object |
a |
i, j |
indices specifying elements to extract.
Details in Extract and |
name |
a literal character string (use backtick when the name includes spaces or special characters). |
N |
a list which defines the |
The function namesList
returns the list representing the structure of
a mlth.data.frame
object. The variables are represented by their names
(single character string or vector), the sub-tables are represented by named
list or character vector (when a sub-table does not include another sub-table.
See Examples.
The function selectByList
selects the parts of a mlth.data.frame
corresponding to the list structure. [[
and [
call selectByList
when i
is a list.
L <- mlth(X = c('A', 'B', 'C'),
Y = list(N = 1:3, M = 4:6))
L['Y']
L[['Y']]
L$Y ## Same as L[['Y']]
L$Y$M
L[1:2, ] ## Select rows
## Select using a list structure
namesList(L)
L[[list(Y = c('N', 'M', 'N'), 'X')]]
selectByList(L,list(Y=c('N','M','N'),'X')) # Same
L[1:2, list(Y = c('N', 'M', 'N'), 'X')]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.