freqtab
creates a frequency table from a vector or data.frame
of scores. When the items
argument is included, scores are assumed to
be item responses, which are summed to create total scores. The scores are
tabulated and stored as an array, with dimensions for each variable. Note
that in previous versions of the “freqtab
” class the frequency
table was stored as a data.frame
. This is no longer the case.
Instead, the table is stored as an array and converted to a
data.frame
when printed or manipulated with the head
and
tail
methods.
as.data.frame
converts an object of class “freqtab
” to
“data.frame
”. droplevels
returns x
with any
unused factor levels, or levels with zero counts, removed.
When x
is an object of class “table
”, freqtab
simply modifies the attributes and converts to class
“freqtab
”. In this case, x
must already be structured
similar to a “freqtab
” object, with the first dimension
containing counts for total scores, and remaining dimensions containing
counts for one or more anchor tests.
as.freqtab
converts a 'flat' contingency table (see
ftable
) to class “freqtab
” with the appropriate
attributes. A flat contingency table is the data.frame
version of a
“freqtab
” object, where the first column contains the total
score scale, the last column contains counts, and the columns in between
contain different anchor test score combinations. is.freqtab
tests
for class “freqtab
”.
scales
extracts the measurement scales for the variables specified in
margin
, with margin = 1
referring to the total score scale,
and subsequent margins referring to anchor tests. margin
is a wrapper
for margin.table
, which itself is a simple wrapper for summing
over marginal counts, i.e., apply(x, margin, sum)
. And margins
returns the number of dimensions, i.e., score variables, in a frequency
table.
design
is used to set the dimnames of the frequency table, with
total1
and total2
used with single and counterbalanced groups,
and total
and anchor
(s) used otherwise. design
also
sets the design attribute, which is used in equate
.
The main difference between the “freqtab
” class and other
tabulation classes, like “table
” and “ftable
”,
is that the dimnames
, i.e., the score scales, are required to be
numeric. This facilitates plotting with plot.freqtab
, equating
with the equate
function, and descriptive statistics with the
summary.freqtab
and other methods.