Matrix manipulation in R are very useful in Linear Algebra. Below are list of common yet important functions in dealing operations with matrices:
Transposing these, simply use
Multiplying these, would be
For the determinant, we have
Taking the inverse of
Finally, for eigenvalues and eigenvectors simply use
The output above returns the
- Transpose -
t; - Multiplication -
%*%; - Determinant -
det; and, - Inverse -
solve, orginvof MASS library - Eigenvalues and Eigenvectors -
eigen
Transposing these, simply use
t
Multiplying these, would be
For the determinant, we have
Taking the inverse of
matrix1 is achieved by solve or ginv R functions. Note that ginv is in MASS package, and so we haveFinally, for eigenvalues and eigenvectors simply use
eigen The output above returns the
$values, which is the eigenvalues, and $vectors, the eigenvectors.
Comments
Post a Comment