eelbrain.table.cast_to_ndvar
- eelbrain.table.cast_to_ndvar(data, dim_values, match, sub=None, ds=None, dim=None, unit='s', name=None)
Create an NDVar by converting a data column to a dimension
- Parameters
data (
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.sub (
Union
[Var
,ndarray
,str
,None
]) – Use a subset of the data.dim (
Optional
[str
]) – Name for the new dimension. Usedim='uts'
to createUTS
time dimension from scalardim_values
.unit (
str
) – Unit forUTS
dimension (ignored otherwise).name (
Optional
[str
]) – Name for the newNDVar
(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