eelbrain.Interaction.count

Interaction.count(self, value, start=-1)

Cumulative count of the occurrences of value

Parameters:
value : str | tuple (value in .cells)

Cell value which is to be counted.

start : int

Value at which to start counting (with the default of -1, the first occurrence will be 0).

Returns:
count : Var of int, len = len(self)

Cumulative count of value in self.

Examples

>>> a = Factor('abc', tile=3)
>>> a
Factor(['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c'])
>>> a.count('a')
array([0, 0, 0, 1, 1, 1, 2, 2, 2])