eelbrain.table.cast_to_ndvar

eelbrain.table.cast_to_ndvar(data, dim_values, match, sub=None, ds=None, dim=None, name=None)

Create an NDVar by converting a data column to a dimension

Parameters:
data : Var

Data to be cast.

dim_values : Var | Factor

Location on the new dimension.

match : Factor | Interaction

Indicating rows which belong the the same case in the NDvar.

sub : index

Use a subset of the data.

ds : Dataset

Dataset with data for operation.

dim : str

Name for the new dimension. Use dim='uts' to create UTS time dimension from scalar dim_values.

name : str

Name for the new NDVar (the default is the name of dim_values).

Returns:
short_ds : Dataset

Copy of ds, aggregated over dim_values, and with an NDVar containing the values form data and a new dimension reflecting dim_values. If dim_values is a Factor, the new dimension is Categorial; if dim_values is a Var, it is Scalar. The new dimension’s name is dim. The only exception to this is that when dim='uts', the new dimension is UTS named 'time'.