eelbrain.Interaction.as_factor

Interaction.as_factor(self, delim=' ', name=None)

Convert the Interaction to a factor

Parameters:
delim : str

Delimiter to join factor cell values (default " ").

name : str

Name for the Factor (default is None).

Examples

>>> print(ds[::20, 'A'])
Factor(['a1', 'a1', 'a2', 'a2'], name='A')
>>> print(ds[::20, 'B'])
Factor(['b1', 'b2', 'b1', 'b2'], name='B')
>>> i = ds.eval("A % B")
>>> print(i.as_factor()[::20])
Factor(['a1 b1', 'a1 b2', 'a2 b1', 'a2 b2'], name='AxB')
>>> print(i.as_factor("_")[::20])
Factor(['a1_b1', 'a1_b2', 'a2_b1', 'a2_b2'], name='AxB')