Vector

Vector

The Vector class implements a store for arbitrary per-element metadata and per-element names. It is intended as a base class for other structures that have a concept of "vector-ness". It should not be constructed directly.

Constructor

new Vector(length, optionsopt)

Source:
Parameters:
Name Type Attributes Default Description
length number

Number of elements in this vector-like object.

options Object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
elementMetadata DataFrame <optional>
<nullable>
null

A DataFrame with number of rows equal to the length of start, containing arbitrary per-element annotations. Alternatively null, in which case a zero-column DataFrame is automatically constructed.

metadata Object <optional>
{}

Object containing arbitrary metadata as key-value pairs.

Extends

Classes

Vector

Methods

$setElementMetadata(elementMetadatanullable) → {Vector}

Source:
Parameters:
Name Type Attributes Description
elementMetadata DataFrame <nullable>

Arbitrary metadata for each vector element. This should have number of rows equal to the vector length. Alternatively null, in which case all existing per-element metadata is removed.

Returns:

A reference to this Vector object after setting the element metadata to value.

Type
Vector

$setMetadata(value) → {Annotated}

Source:
Overrides:
Parameters:
Name Type Description
value Object

Object containing the metadata.

Returns:

A reference to this Annotated object.

Type
Annotated

$setNames(namesnullable) → {Vector}

Source:
Parameters:
Name Type Attributes Description
names Array <nullable>

Array of strings containing a name for each range. This should have length equal to the number of ranges. Alternatively null, if no names are present.

Returns:

A reference to this Vector object after setting the element metadata to value.

Type
Vector

elementMetadata() → {DataFrame}

Source:
Returns:

A DataFrame with one row corresponding to each vector element, containing arbitrary per-element metadata.

Type
DataFrame

metadata() → {Map}

Source:
Overrides:
Returns:

Map containing arbitrary metadata.

Type
Map

names() → (nullable) {Array}

Source:
Returns:

Array of strings containing the name of each range, or null if no names are available.

Type
Array

setElementMetadata(elementMetadatanullable, optionsopt) → {Vector}

Source:
Parameters:
Name Type Attributes Default Description
elementMetadata DataFrame <nullable>

Arbitrary metadata for each vector element. This should have number of rows equal to the vector length. Alternatively null, in which case all existing per-element metadata is removed.

options Object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
inPlace boolean <optional>
false

Whether to mutate this Vector instance in place. If false, a new instance is returned.

Returns:

The Vector object after setting the element metadata to value. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
Vector

setMetadata(value, optionsopt) → {Annotated}

Source:
Overrides:
Parameters:
Name Type Attributes Default Description
value Object | Map

Object containing the metadata.

options Object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
inPlace boolean <optional>
false

Whether to mutate this Annotated instance in place. If false, a new instance is returned.

Returns:

The Annotated object after replacing the metadata. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
Annotated

setNames(namesnullable, optionsopt) → {Vector}

Source:
Parameters:
Name Type Attributes Default Description
names Array <nullable>

Array of strings containing a name for each range. This should have length equal to the number of ranges. Alternatively null, if no names are present.

options Object <optional>
{}

Optional parameters.

Properties
Name Type Attributes Default Description
inPlace boolean <optional>
false

Whether to mutate this Vector instance in place. If false, a new instance is returned.

Returns:

The Vector object after setting the names to value. If inPlace = true, this is a reference to the current instance, otherwise a new instance is created and returned.

Type
Vector