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 d1 and d2 describe the same cases, but their order does not correspond. align() uses the index variables i1 and i2 to match each case in d2 to a case in d1 (i.e., d1 is used as the basis for the case order in the output), and returns reordered versions of of d1 and d2 with matching cases. Cases that are present in only one of d1 and d2 are 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 align d1 if out='index').

  • d2_aligned (data-object | array) – Aligned copy of d2 (or index to align d2 if out='index').

See also

align1

Align one data-object to an index variable

Examples

See Align datasets example.