eelbrain.table.cast_to_ndvar

eelbrain.table.cast_to_ndvar(y, dim_values, match, sub=None, data=None, dim=None, unit='s', name=None)

Create an NDVar by converting a data column to a dimension

Parameters:
  • y (Var | str | Sequence[Var | str]) – Data to be cast.

  • dim_values (Var | str | Factor) – Location on the new dimension.

  • match (Factor | Interaction | NestedEffect | str) – Indicating rows which belong the the same case in the NDvar.

  • sub (Var | ndarray | str) – Use a subset of the data.

  • data (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.

  • unit (str) – Unit for UTS dimension (ignored otherwise).

  • name (str) – Name for the new NDVar (the default is the name of data).

Returns:

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'.

Return type:

short_ds

See also

melt_ndvar