powered by
data.frame
x
t
t(x)
"data.frame"
A data frame is first coerced to a matrix: see as.matrix. When x is a vector, it is treated as a column, i.e., the result is a 1-row matrix.
as.matrix
aperm
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(! all(a[, j] == ta[j, ])) stop("wrong transpose")
Run the code above in your browser using DataLab