riditsrefgroup: Utility to determine reference group. Primarily for internal...

Description Usage Arguments Value Author(s) Examples

View source: R/riditsrefgroup.R

Description

For internal use.

Usage

1
riditsrefgroup(x, margin, ref = NULL)

Arguments

x

matrix of counts or proportions

margin

margin that represents groups. 1 for rows, 2 for columns

ref

group to use as reference. if omitted, use totals across groups. if a vector, use it. otherwise use the group with its number (or name if available)

Value

vector of counts/proportions to use as reference group

Author(s)

Eric Bohlman

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## The function is currently defined as
function (x, margin, ref = NULL)
{
    if (length(ref) > 1) {
        refgroup <- ref
    }
    else if (length(ref) == 1) {
        if (margin == 1) {
            refgroup <- x[ref, ]
        }
        else {
            refgroup <- x[, ref]
        }
    }
    else {
        refgroup <- apply(x, 3 - margin, sum)
    }
  }

ridittools documentation built on May 1, 2019, 6:30 p.m.