subset,LongTable-method {CoreGx} | R Documentation |
Subset method for a LongTable object.
Description
Allows use of the colData and rowData data.table
objects to query based on
rowID and colID, which is then used to subset all value data.tables stored
in the dataList slot.
This function is endomorphic, it always returns a LongTable object.
Usage
## S4 method for signature 'LongTable'
subset(x, i, j, assays, reindex = TRUE)
Arguments
x |
LongTable The object to subset.
|
i |
character , numeric , logical or expression
Character: pass in a character vector of drug names, which will subset the
object on all row id columns matching the vector.
Numeric or Logical: these select based on the rowKey from the rowData
method for the LongTable .
Call: Accepts valid query statements to the data.table i parameter,
this can be used to make complex queries using the data.table API
for the rowData data.table.
|
j |
character , numeric , logical or expression
Character: pass in a character vector of drug names, which will subset the
object on all drug id columns matching the vector.
Numeric or Logical: these select based on the rowID from the rowData
method for the LongTable .
Call: Accepts valid query statements to the data.table i parameter,
this can be used to make complex queries using the data.table API
for the colData data.table.
|
assays |
character , numeric or logical Optional list of assay
names to subset. Can be used to subset the assays list further,
returning only the selected items in the new LongTable.
|
reindex |
logical Should the col/rowKeys be remapped after subsetting.
defaults to TRUE. For chained subsetting you may be able to get performance
gains by setting to FALSE and calling reindex() manually after subsetting
is finished.
|
Value
LongTable
A new LongTable
object subset based on the specified
parameters.
Examples
# Character
subset(merckLongTable, 'ABT-888', 'CAOV3')
# Numeric
subset(merckLongTable, 1, c(1, 2))
# Logical
subset(merckLongTable, , colData(merckLongTable)$cellid == 'A2058')
# Call
subset(merckLongTable, drug1id == 'Dasatinib' & drug2id != '5-FU',
cellid == 'A2058')
[Package
CoreGx version 1.6.0
Index]