anti_t: Compute the anti-transpose of a square matrix or table

View source: R/numericFunctions.R

anti_tR Documentation

Compute the anti-transpose of a square matrix or table

Description

The anti-transpose of a square matrix or table x is the transpose taken across the off-diagonal. anti-t is a convenience wrapper for apply(apply(x, 2, rev), 1, rev).

The anti-transpose function is useful, for example, for converting the results of table(Test, Gold) to a "confusion" matrix, and vice-versa.

A C implementation of the anti-transpose function can also be found as in package gclm as gclm:::anti_t.

Usage

anti_t(x)

Arguments

x

A square matrix or table.

Value

The anti-transpose (transpose across the off-diagonal) of x.

Examples

Gold <- rbinom(20, 1, 0.50)
Test <- Gold; Test[c(3, 5, 9, 12, 16)] <- 1 - Test[c(3, 9, 5, 12, 16)]
(tb <- table(Test, Gold))
anti_t(tb)

sgutreuter/SGmisc documentation built on Aug. 25, 2024, 7:21 p.m.