Learn R Programming

ridittools (version 0.1)

meanridits: Compute mean ridits of multiple groups

Description

Computes mean ridits of multiple groups in a crosstab matrix. Groups can be either rows or columns, with the other dimension representing the response categories.

Usage

meanridits(x, margin, ref = NULL)

Arguments

x

matrix of cross-tabulated counts or proportions

margin

1 for groups in rows, 2 for groups in columns

ref

if omitted, use totals across groups as reference group

if vector of counts (or proportions), use as reference group

otherwise, number (or name if it exists) of group to use as reference

Value

vector of mean ridits

Examples

Run this code
# NOT RUN {
meanridits(flu.age, 2)
meanridits(flu.age, 2, "H3")
meanridits(handgun, 2, 1)
meanridits(handgun, 2, rowSums(handgun[ , 2:4]))

## The function is currently defined as
function (x, margin, ref = NULL)
{
    apply(x, margin, meanridit, riditsrefgroup(x, margin, ref))
  }
# }

Run the code above in your browser using DataLab