R-version of the code for “Linear Algebra: Theory, Intuition, Code” by Mike X Cohen
2021-03-26
Introduction
This is an R-version of the code for “Linear Algebra: Theory, Intuition, Code” by Mike X Cohen. I have tried to keep the code as close to the original as possible even if it went against the spirit of R. E.g., some loops can be replaced with vectorized operations, tidyverse piping approach, or apply()
/replicate()
/purrr::map()
. In most cases, I use library::
disambiguation to make it easier to understand which function belongs to which package, in addition to importing libraries via library()
.
Libraries the code relies upon
Matrix calculations
- pracma
- geigen for generalized eigenvalues
- matrixcalc for raising matrix to the power
Tidyverse packages for data wrangling, you can install all relevant packages (including ggplot2) via install.packages("tidyverse")
.
Graphics
- ggplot2 for plotting
- plotly for 3D surface plot
- patchwork to create a composite figure out of multiple plots
- RColorBrewer for color schemes
- imager for working with images