t {base}R Documentation

Matrix Transpose

Description

Given a matrix or data.frame x, t returns the transpose (matrix or data.frame) of x.

Usage

t(x)

Arguments

x a matrix or data frame.

See Also

aperm for permuting the dimensions of arrays.

Examples

a <- matrix(1:30, 5,6)
ta <- t(a) ##-- i.e.,  a[i, j] == ta[j, i] for all i,j :
for(j in seq(ncol(a)))
  if(! a[, j] == ta[j, ]) stop("wrong transpose")

[Package Contents]