Vector.CreateCategorical Method

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4

Overload List

CreateCategorical<T>(IList<T>) Constructs a categorical vector from a list of values.
CreateCategorical<T>(Int32, Boolean) Constructs a new categorical vector of the specified length.
CreateCategorical<T>(IList<T>, ArrayMutability, Boolean) Constructs a categorical vector from a list of values.
CreateCategorical<T>(IList<T>, Index<T>, ArrayMutability, Boolean) Constructs a categorical vector from a list of values.
CreateCategorical<T>(IList<T>, SortOrder, ArrayMutability, Boolean) Constructs a categorical vector from a list of values.
CreateCategorical<T>(Index<T>, IList<Int32>, ArrayMutability, Boolean) Constructs a categorical vector from an index and level indexes.

CreateCategorical<T>(IList<T>)

Constructs a categorical vector from a list of values.
C#
public static CategoricalVector<T> CreateCategorical<T>(
	IList<T> values
)

Parameters

values  IList<T>
A list of values.

Type Parameters

T
The element type of the vector.

Return Value

CategoricalVector<T>
A categorical vector with the specified values.

CreateCategorical<T>(Int32, Boolean)

Constructs a new categorical vector of the specified length.
C#
public static CategoricalVector<T> CreateCategorical<T>(
	int length,
	bool checkMissingValues = false
)

Parameters

length  Int32
The length of the new vector.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the vector should check for the presence of missing values. The default is false.

Type Parameters

T

Return Value

CategoricalVector<T>

CreateCategorical<T>(IList<T>, ArrayMutability, Boolean)

Constructs a categorical vector from a list of values.
C#
public static CategoricalVector<T> CreateCategorical<T>(
	IList<T> values,
	ArrayMutability mutability = ArrayMutability.Immutable,
	bool checkMissingValues = false
)

Parameters

values  IList<T>
A list of values.
mutability  ArrayMutability  (Optional)
Specifies how the vector's values may be changed. The default is immutable.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the vector should check for the presence of missing values. The default is false.

Type Parameters

T
The element type of the vector.

Return Value

CategoricalVector<T>
A categorical vector with the specified values.

CreateCategorical<T>(IList<T>, Index<T>, ArrayMutability, Boolean)

Constructs a categorical vector from a list of values.
C#
public static CategoricalVector<T> CreateCategorical<T>(
	IList<T> values,
	Index<T> categoryIndex,
	ArrayMutability mutability = ArrayMutability.Immutable,
	bool checkMissingValues = false
)

Parameters

values  IList<T>
A list of values.
categoryIndex  Index<T>
The index used to encode the categories.
mutability  ArrayMutability  (Optional)
Specifies how the vector's values may be changed. The default is immutable.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the vector should check for the presence of missing values. The default is false.

Type Parameters

T
The element type of the vector.

Return Value

CategoricalVector<T>
A categorical vector with the specified values.

CreateCategorical<T>(IList<T>, SortOrder, ArrayMutability, Boolean)

Constructs a categorical vector from a list of values.
C#
public static CategoricalVector<T> CreateCategorical<T>(
	IList<T> values,
	SortOrder sortOrder,
	ArrayMutability mutability = ArrayMutability.Immutable,
	bool checkMissingValues = false
)

Parameters

values  IList<T>
A list of values.
sortOrder  SortOrder
Specifies the sort order of the category index. If None, categories appear in the order they first appear in values.
mutability  ArrayMutability  (Optional)
Optional. Specifies how the vector's values may be changed. The default is immutable.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the vector should check for the presence of missing values. The default is false.

Type Parameters

T
The element type of the vector.

Return Value

CategoricalVector<T>
A categorical vector with the specified values.

CreateCategorical<T>(Index<T>, IList<Int32>, ArrayMutability, Boolean)

Constructs a categorical vector from an index and level indexes.
C#
public static CategoricalVector<T> CreateCategorical<T>(
	Index<T> index,
	IList<int> levels,
	ArrayMutability mutability = ArrayMutability.Immutable,
	bool checkMissingValues = false
)

Parameters

index  Index<T>
An index.
levels  IList<Int32>
A list of integer level indexes.
mutability  ArrayMutability  (Optional)
Specifies how the vector's values may be changed. The default is immutable.
checkMissingValues  Boolean  (Optional)
Optional. Specifies whether operations involving the vector should check for the presence of missing values. The default is false.

Type Parameters

T
The element type of the vector.

Return Value

CategoricalVector<T>
A categorical vector with category index index and level indexes levels.

Remarks

To specify a missing value, set its level index to -1.

See Also