xt: Construct a two-way frequency table (matrix) from a 2 or 3...

Description Usage Arguments Details Value Author(s) References Examples

Description

Construct a two-way frequency table (matrix) by reforming and aggregating counts into bins.

Usage

1
xt(trn, fr.col, to.col, cnt.col = NULL, brk = NULL)

Arguments

trn

An array or data frame with two or three columns (either from, to or from, to, count). Each row should at least designate the from-group & to-group (count is optional).

From To Count
x1 x1 40
x1 x2 89
... ... ...
fr.col

The column number of t for the ‘from’ variable, which will be reformed to vary across columns in the output matrix.

to.col

The column number of t for the ‘to’ variable, which will be reformed to vary across rows in the output matrix.

cnt.col

(optional) The column number of t for the ‘count’ variable. If unspecified then each row will be counted as one observation.

brk

(optional) Either a value indicating the number of bins to aggregate t into, or a vector specifying the breakpoints to use if probabilistically equivalent bin ranges are desired. Equivalent ranges can be calculated using brkpts.

Details

xt requires an array or data frame of numeric values and returns a two-way table of frequencies that can be optionally grouped into bins of a specified range.

Value

Returns a two-way table of frequencies in the form:

Fr
40 38 37 ...
To 89 89 87 ...
75 74 89 ...
... ... ... ...

Author(s)

Bjorn J. Brooks, Lars Y. Pomara, Danny C. Lee

References

PAPER TITLE.

Examples

1
2
3
4
5
6
data(transitions)                # Load example data
b <- brkpts(transitions$phenofr, # 10 probabilistically
            10)                  #  equivalent breakpoints
m <- xt(transitions, fr.col=2,   # Construct a two-way table
        to.col=3, cnt.col=4,
        brk=b)

bjornbrooks/landat documentation built on May 17, 2019, 7:32 p.m.