Learn R Programming

matlib (version 1.0.1)

Matrix Functions for Teaching and Learning Linear Algebra and Multivariate Statistics

Description

A collection of matrix functions for teaching and learning matrix linear algebra as used in multivariate statistical methods. Many of these functions are designed for tutorial purposes in learning matrix algebra ideas using R. In some cases, functions are provided for concepts available elsewhere in R, but where the function call or name is not obvious. In other cases, functions are provided to show or demonstrate an algorithm. In addition, a collection of functions are provided for drawing vector diagrams in 2D and 3D and for rendering matrix expressions and equations in LaTeX.

Copy Link

Version

Install

install.packages('matlib')

Monthly Downloads

11,683

Version

1.0.1

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Michael Friendly

Last Published

October 9th, 2025

Functions in matlib (1.0.1)

buildTmat

Build/Get transformation matrices
QR

QR Decomposition by Graham-Schmidt Orthonormalization
arrows3d

Draw 3D arrows
SVD

Singular Value Decomposition of a Matrix
Proj

Projection of Vector y on columns of X
R

Rank of a Matrix
adjoint

Calculate the Adjoint of a matrix
angle

Angle between two vectors
Solve

Solve and Display Solutions for Systems of Linear Simultaneous Equations
arc

Draw an arc showing the angle between vectors
cone3d

Draw a 3D cone
circle3d

Draw a horizontal circle
cholesky

Cholesky Square Root of a Matrix
echelon

Echelon Form of a Matrix
gaussianElimination

Gaussian Elimination
circle

Draw circles on an existing plot.
corner

Draw a corner showing the angle between two vectors
class

Class Data Set
cofactor

Cofactor of A[i,j]
coffee

Data on Coffee, Stress and Heart Damage
matlib-package

matlib: Matrix Functions for Teaching and Learning Linear Algebra and Multivariate Statistics.
minor

Minor of A[i,j]
getYmult

Correct for aspect and coordinate ratio
latexMatrixOperations

Various Functions and Operators for "latexMatrix" Objects
len

Length of a Vector or Column Lengths of a Matrix
gsorth

Gram-Schmidt Orthogonalization of a Matrix
is_square_matrix

Test for square matrix
latexMatrix

Create and Manipulate LaTeX Representations of Matrices
matrix2latex

(Deprecated) Convert matrix to LaTeX equation
mpower

Matrix Power
regvec3d

Vector space representation of a two-variable regression model
printMatrix

(Deprecated) Print a matrix, allowing fractions or LaTeX output
plot.regvec3d

Plot method for regvec3d objects
plotEqn

Plot Linear Equations
therapy

Therapy Data
svdDemo

Demonstrate the SVD for a 3 x 3 matrix
tr

Trace of a Matrix
rowCofactors

Row Cofactors of A[i,]
showEqn

Show Matrices (A, b) as Linear Equations
rowMinors

Row Minors of A[i,]
printMatEqn

Print Matrices or Matrix Operations Side by Side
powerMethod

Power Method for Eigenvectors
plotEqn3d

Plot Linear Equations in 3D
pointOnLine

Position of a point along a line
rowmult

Multiply Rows by Constants
rowadd

Elementary Row Operations
showEig

Show the eigenvectors associated with a covariance matrix
xprod

Generalized Vector Cross Product
rowswap

Interchange two rows of a matrix
workers

Workers Data
swp

The Matrix Sweep Operator
vectors3d

Draw 3D vectors
vectors

Draw geometric vectors in 2D
symMat

Create a Symmetric Matrix from a Vector
vec

Vectorize a Matrix
vandermode

Vandermode Matrix
Eigen

Eigen Decomposition of a Square Symmetric Matrix
GramSchmidt

Gram-Schmidt Orthogonalization of a Matrix
J

Create a vector, matrix or array of constants
Inverse

Inverse of a Matrix
Eqn

Create a LaTeX Equation Wrapper
Det

Determinant of a Square Matrix
LU

LU Decomposition
MoorePenrose

Moore-Penrose inverse of a matrix
Ginv

Generalized Inverse of a Matrix
Eqn_helpers

Helpers to Compose Equations with Eqn