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 (Union[Var, str, Sequence[Union[Var, str]]]) – Data to be cast.
dim_values (Union[Var, str, Factor]) – Location on the new dimension.
match (Union[Factor, Interaction, NestedEffect, str]) – Indicating rows which belong the the same case in the NDvar.
data (Dataset) – Dataset with data for operation.
dim (str) – Name for the new dimension. Use
dim='uts'
to createUTS
time dimension from scalardim_values
.unit (str) – Unit for
UTS
dimension (ignored otherwise).name (str) – Name for the new
NDVar
(the default is the name ofdata
).
- Returns
Copy of
ds
, aggregated overdim_values
, and with anNDVar
containing the values formdata
and a new dimension reflectingdim_values
. Ifdim_values
is a Factor, the new dimension isCategorial
; ifdim_values
is aVar
, it isScalar
. The new dimension’s name isdim
. The only exception to this is that whendim='uts'
, the new dimension isUTS
named'time'
.- Return type
short_ds
See also