Learn R Programming

miscset (version 1.0.0)

squarematrix: Create a Square Matrix

Description

Transform any m x n matrix to a square matrix by column/row names. Stops if no or duplicated dimnames are provided in x.

Usage

squarematrix(x)

Arguments

x
Object of class matrix.

Value

Returns a matrix.

Examples

Run this code
#

m <- matrix(1:6, 2, dimnames=list(2:3,1:3))
m
squarematrix(m)

#

Run the code above in your browser using DataLab