Cross-tabulates the values of the given numeric matrix.
Returns a hash-map with the following fields:
:table -- the table of counts for each combination of values,
this table is only returned if x has two-columns
:levels -- a sequence of sequences, where each sequence list
the levels (possible values) of the corresponding
column of x.
:margins -- a sequence of sequences, where each sequence
represents the marginal total for each level
of the corresponding column of x.
:counts -- a hash-map, where vectors of unique combinations
of the cross-tabulated levels are the keys and the
values are the total count of each combination.
:N -- the grand-total for the contingency table
Examples:
(use '(incanter core stats))
(tabulate [1 2 3 2 3 2 4 3 5])
(tabulate (sample-poisson 100 :lambda 5))
(use '(incanter core stats datasets))
(def math-prog (to-matrix (get-dataset :math-prog)))
(tabulate (sel math-prog :cols [1 2]))
(def data (matrix [[1 0 1]
[1 1 1]
[1 1 1]
[1 0 1]
[0 0 0]
[1 1 1]
[1 1 1]
[1 0 1]
[1 1 0]]))
(tabulate data)
(def data (matrix [[1 0]
[1 1]
[1 1]
[1 0]
[0 0]
[1 1]
[1 1]
[1 0]
[1 1]]))
(tabulate data)
Comments top
No comments for tabulate. Log in to add a comment.