Skip to contents

Single bracket subsetting for a LongTable object. See subset for more details.

Usage

# S4 method for LongTable,ANY,ANY,ANY
[(x, i, j, assays = assayNames(x), ..., drop = FALSE)

Arguments

x

LongTable The object to subset.

i

character, numeric, logical or call Character: pass in a character vector of drug names, which will subset the object on all row id columns matching the vector. This parameter also supports valid R regex query strings which will match on the colnames of x. For convenience, * is converted to .* automatically. Colon can be to denote a specific part of the colnames string to query. 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 as a call object. We have provided the function .() to conveniently convert raw R statements into a call for use in this function.

j

character, numeric, logical or call Character: pass in a character vector of drug names, which will subset the object on all drug id columns matching the vector. This parameter also supports regex queries. Colon can be to denote a specific part of the colnames string to query. 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 as a call object. We have provided the function .() to conveniently convert raw R statements into a call for use in this function.

assays

character Names of assays which should be kept in the LongTable after subsetting.

...

Included to ensure drop can only be set by name.

drop

logical Included for compatibility with the '[' primitive, it defaults to FALSE and changing it does nothing.

Value

A LongTable containing only the data specified in the function parameters.

Details

This function is endomorphic, it always returns a LongTable object.

Examples

# Character
merckLongTable['ABT-888', 'CAOV3']
#> <LongTable> 
#>    dim:  42 2 
#>    assays(2): sensitivity profiles 
#>    rownames(42): ABT-888:MK-8776:0.35:0.0925 ABT-888:MK-8776:0.35:0.325 ... Zolinza:ABT-888:0.0925:0.35 Zolinza:ABT-888:0.0925:1.08 
#>    rowData(5): drug1id drug2id drug1dose drug2dose combination_name 
#>    colnames(2): CAOV3:1 CAOV3:3 
#>    colData(2): sampleid batchid 
#>    metadata(0): none 
# Numeric
merckLongTable[1, c(1, 2)]
#> <LongTable> 
#>    dim:  1 1 
#>    assays(2): sensitivity profiles 
#>    rownames(1): 5-FU:Bortezomib:0.35:0.00045 
#>    rowData(5): drug1id drug2id drug1dose drug2dose combination_name 
#>    colnames(1): A2058:1 
#>    colData(2): sampleid batchid 
#>    metadata(0): none 
# Logical
merckLongTable[, colData(merckLongTable)$sampleid == 'A2058']
#> <LongTable> 
#>    dim:  744 2 
#>    assays(2): sensitivity profiles 
#>    rownames(744): 5-FU:Bortezomib:0.35:0.00045 5-FU:Bortezomib:0.35:0.002 ... geldanamycin:Topotecan:0.0223:0.0223 geldanamycin:Topotecan:0.0223:0.0775 
#>    rowData(5): drug1id drug2id drug1dose drug2dose combination_name 
#>    colnames(2): A2058:1 A2058:3 
#>    colData(2): sampleid batchid 
#>    metadata(0): none 
# Call
merckLongTable[
     .(drug1id == 'Dasatinib' & drug2id != '5-FU'),
     .(sampleid == 'A2058'),
 ]
#> <LongTable> 
#>    dim:  8 1 
#>    assays(2): sensitivity profiles 
#>    rownames(8): Dasatinib:Dinaciclib:0.024:0.000925 Dasatinib:Dinaciclib:0.024:0.00325 ... Dasatinib:Sorafenib:0.024:10 Dasatinib:Sorafenib:0.024:20 
#>    rowData(5): drug1id drug2id drug1dose drug2dose combination_name 
#>    colnames(1): A2058:1 
#>    colData(2): sampleid batchid 
#>    metadata(0): none