subset-LongTable-method: Subset method for a LongTable object.

Description Usage Arguments Value Examples

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

1
2
## 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

1
2
3
4
5
6
7
8
9
# Character
subset(merckLongTable, 'CAOV3', 'ABT-888')
# Numeric
subset(merckLongTable, 1, c(1, 2))
# Logical
subset(merckLongTable, rowData(merckLongTable)$cell_line1 == 'A2058')
# Call
subset(merckLongTable, cell_line1 == 'A2058',
  drug1 == 'Dasatinib' & drug2 != '5-FU')

CoreGx documentation built on Nov. 8, 2020, 4:50 p.m.