eelbrain.align
- eelbrain.align(d1, d2, i1='index', i2=None, out='data')
Align two data-objects based on index variables
Before aligning, two data-objects
d1andd2describe the same cases, but their order does not correspond.align()uses the index variablesi1andi2to match each case ind2to a case ind1(i.e.,d1is used as the basis for the case order in the output), and returns reordered versions of ofd1andd2with matching cases. Cases that are present in only one ofd1andd2are dropped.- Parameters:
d1 (data-object) – Two data objects which are to be aligned
d2 (data-object) – Two data objects which are to be aligned
i1 (str | Var | Factor | Interaction) – Indexes for cases in d1 and d2. If d1 and d2 are Datasets, i1 and i2 can be keys for variables in d1 and d2. If i2 is identical to i1 it can be omitted. Indexes have to supply a unique value for each case.
i2 (str | Var | Factor | Interaction) – Indexes for cases in d1 and d2. If d1 and d2 are Datasets, i1 and i2 can be keys for variables in d1 and d2. If i2 is identical to i1 it can be omitted. Indexes have to supply a unique value for each case.
out ('data' | 'index') – ‘data’: returns the two aligned data objects. ‘index’: returns two indices index1 and index2 which can be used to align the datasets with
d1[index1]; d2[index2].
- Returns:
d1_aligned (data-object | array) – Aligned copy of
d1(or index to alignd1ifout='index').d2_aligned (data-object | array) – Aligned copy of
d2(or index to alignd2ifout='index').
See also
align1Align one data-object to an index variable
Examples
See Align datasets example.