Skip to content

Commit

Permalink
DOC table.frequencies()
Browse files Browse the repository at this point in the history
  • Loading branch information
christianbrodbeck committed Dec 11, 2016
1 parent 9451f9f commit cbfcb26
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion eelbrain/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def frequencies(y, x=None, of=None, sub=None, ds=None):
Factor with values whose frequencies are of interest.
x : None | categorial
Optional model defining cells for which frequencies are displayed
separately.
separately. Each row corresponds to one level of ``x``.
of : None | categorial
With ``x`` constant within ``of``, only count frequencies for each value
in ``of`` once. (Compress y and x before calculating frequencies.)
Expand All @@ -104,6 +104,32 @@ def frequencies(y, x=None, of=None, sub=None, ds=None):
-------
freq : Dataset
Dataset with frequencies.
Examples
--------
A simple sample dataset::
>>> ds = Dataset()
>>> ds['a'] = Factor('aabbcc')
>>> ds['x'] = Factor('xxxyyy')
Display frequency of a single factor's cells::
>>> print table.frequencies('a', ds=ds)
cell n
--------
a 2
b 2
c 2
Display frequency of interaction cells::
>>> print table.frequencies('a', 'x', ds=ds)
x a b c
-------------
x 2 1 0
y 0 1 2
"""
sub = assub(sub, ds)
y = ascategorial(y, sub, ds)
Expand Down

0 comments on commit cbfcb26

Please sign in to comment.