Methods
CLONE(x, optionsopt) → {*}
- Source:
Clone a vector-like object.
This function supports built-in types like TypedArrays, Arrays, objects and Maps, as well as the various primitive types (e.g., number, string) that are returned by value. If a deep copy is requested, this function will recursively clone all elements of the Array, values of the object, or key/value pairs of the Map.
Custom classes should provide a _bioconductor_CLONE
method to define the cloning operation.
This method should accept options
and should return an appropriately cloned instance of the same class as x
.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
x |
* | Some vector-like object. |
||||||||||||
options |
Object |
<optional> |
{}
|
Optional parameters. Properties
|
Returns:
A clone of x
, i.e., the return value and x
should not compare equal.
If deepCopy = true
, all internal components are also cloned.
Otherwise, data members of x
and its clone may still refer to the same object.
- Type
- *
COMBINE(objects) → {*}
- Source:
Combine multiple vector-like objects.
For Array and TypedArrays, the combined array is of a class that avoids information loss.
Custom classes should implement a _bioconductor_COMBINE
method to combine objects via this generic.
This method will be invoked from the first instance of objects
and should accept an array of remaining objects (i.e., objects.slice(1)
) to be combined to the first instance.
It return an appropriately-combined instance of the same class as the first instance.
Parameters:
Name | Type | Description |
---|---|---|
objects |
Array | Array of vector-like objects to be combined.
It is assumed that the objects are of the same class, or at least compatible with each other -
for custom classes, the definition of "compatibility" depends on the |
Returns:
A vector-like object containing the concatenated data from the input objects.
- If the first entry of
objects
is an instance of a custom class, the return value should be of the same class. - If all
objects
are TypedArrays of the same class, the return value will be a TypedArray of that class. - If any of the
objects
are Arrays, the return value will be an Array. - If any of the
objects
are 64-bit TypedArrays of different classes, the return value will be an Array. - Otherwise, for any other classes of TypedArrays in
objects
, the return value will be a Float64Array.
- Type
- *
COMBINE_COLUMNS(objects) → {*}
- Source:
Combine multiple two-dimensional objects by column.
Custom classes should implement a _bioconductor_COMBINE_COLUMNS
method to combine objects via this generic.
This method will be invoked from the first instance of objects
and should accept an array of remaining objects (i.e., objects.slice(1)
) to be combined to the first instance.
It return an appropriately-combined instance of the same class as the first instance.
Parameters:
Name | Type | Description |
---|---|---|
objects |
Array | Array of two-dimensional objects to be combined by column.
It is assumed that the objects are of the same class, or at least compatible with each other -
for custom classes, the definition of "compatibility" depends on the |
Returns:
A two-dimensional object of the same class as the first entry of objects
, ontaining the column-wise concatenated data from all objects
.
- Type
- *
COMBINE_ROWS(objects) → {*}
- Source:
Combine multiple two-dimensional objects by row.
Custom classes should implement a _bioconductor_COMBINE_ROWS
method to combine objects via this generic.
This method will be invoked from the first instance of objects
and should accept an array of remaining objects (i.e., objects.slice(1)
) to be combined to the first instance.
It return an appropriately-combined instance of the same class as the first instance.
Parameters:
Name | Type | Description |
---|---|---|
objects |
Array | Array of two-dimensional objects to be combined by row.
It is assumed that the objects are of the same class, or at least compatible with each other -
for custom classes, the definition of "compatibility" depends on the |
Returns:
A two-dimensional object of the same class as the first entry of objects
, ontaining the row-wise concatenated data from all objects
.
- Type
- *
flexibleCombineRows(objects) → {DataFrame}
- Source:
Flexibly combine multiple DataFrames by row by filling in missing columns with an array of null
s.
This is equivalent to calling COMBINE
on an array of DataFrames that may have mismatching columns.
Parameters:
Name | Type | Description |
---|---|---|
objects |
Array | Array of DataFrames to be combined. |
Returns:
The combined DataFrame, where the number of rows is equal to sum of rows across objects
,
and the columns is equal to the union of columns across objects
.
- Type
- DataFrame
LENGTH(x) → {number}
- Source:
Compute the length of a vector-like object.
For Array and TypedArrays, this just returns the length
property directly.
Custom classes should implement a _bioconductor_LENGTH
method to return their length via this generic.
This method should accept no arguments.
Parameters:
Name | Type | Description |
---|---|---|
x |
* | Some vector-like object. |
Returns:
Length of the object.
- Type
- number
NUMBER_OF_COLUMNS(x) → {number}
- Source:
Return the number of columns for a two-dimensional object.
Custom classes should implement a _bioconductor_NUMBER_OF_COLUMNS
method, accepting no arguments.
Parameters:
Name | Type | Description |
---|---|---|
x |
* | Some two-dimensional object. |
Returns:
Number of columns.
- Type
- number
NUMBER_OF_ROWS(x) → {number}
- Source:
Return the number of rows for a two-dimensional object.
Custom classes should implement a _bioconductor_NUMBER_OF_ROWS
method, accepting no arguments.
Parameters:
Name | Type | Description |
---|---|---|
x |
* | Some two-dimensional object. |
Returns:
Number of rows.
- Type
- number
presplitFactor(factor) → {Object}
- Source:
Given a factor, return the indices corresponding to each level.
This can be used in subsequent splitRows
calls.
Parameters:
Name | Type | Description |
---|---|---|
factor |
Array | TypedArray | Array containing the factor of interest. |
Returns:
Object where each key is a factor level and each value is an array containing the indices corresponding to that level in factor
.
- Type
- Object
SLICE(x, i, optionsopt) → {*}
- Source:
Slice a vector-like object.
For Array and TypedArrays, this just uses slice()
or subarray()
.
Custom classes should implement a _bioconductor_SLICE
method to create a slice via this generic.
This method should accept i
and options
, and return a appropriately sliced instance of the same class as x
.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
x |
* | Some vector-like object. |
||||||||||||
i |
Object | Array | TypedArray | An Array or TypedArray of integer indices specifying the slice of Alternatively, an object containing |
||||||||||||
options |
Object |
<optional> |
{}
|
Optional parameters. Properties
|
Returns:
A vector-like object of the same class as x
, containing data for the specified slice.
If allowInPlace = true
, x
may be modified in place, and the return value may be a reference to x
.
- Type
- *
SLICE_2D(x, rowsnullable, columnsnullable, optionsopt) → {*}
- Source:
Slice a two-dimensional object by its rows and/or columns.
Custom classes should implement a _bioconductor_SLICE_2D
method to slice rows/columns via this generic.
This method should accept rows
, columns
and options
, and should return a sliced instance of the same class as x
.
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
x |
* | Some two-dimensional object. |
||||||||||||
rows |
Object | Array | TypedArray |
<nullable> |
An Array or TypedArray of integer indices specifying the row-wise slice of Alternatively, an object containing Alternatively |
|||||||||||
columns |
Object | Array | TypedArray |
<nullable> |
An Array or TypedArray of integer indices specifying the column-wise slice of Alternatively, an object containing Alternatively |
|||||||||||
options |
Object |
<optional> |
{}
|
Optional parameters. Properties
|
Returns:
A two-dimensional object, typically of the same class as x
, containing data for the specified slice.
- Type
- *
SPLIT(x, factor) → {Object}
- Source:
Split a vector-like object along its length according to the levels of a factor of the same length.
This works automatically for all classes for which there is a SLICE
method.
Custom classes may also choose to define their own _bioconductor_SPLIT
method,
which should accept factor
and return an array of sliced instances of the same class as x
.
Parameters:
Name | Type | Description |
---|---|---|
x |
* | Some vector-like object. |
factor |
Array | TypedArray | Array containing the factor to use for splitting.
This should have the same length as Alternatively, the output of |
Returns:
An object containing one key per level of factor
,
where the value is the slice of x
corresponding to the indices of that level in factor
.
- Type
- Object
which(x, optionsopt) → {Array}
- Source:
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
x |
Array | TypedArray | Array of values to be interpreted as truthy or falsey. |
||||||||||||
options |
Object |
<optional> |
{}
|
Optional parameters. Properties
|
Returns:
Array of indices of the entries of x
that are truthy (if not=false
) or falsey (if not=true
).
This array is guaranteed to be sorted in ascending order.
- Type
- Array