mmr

mmr provides simple helpers for matrix multiplication on data.frames. These allow for more concise code during low level mathematical operations, and help ensure code is more easily read, understood, and serviced.

# install.packages("mmr")
library(mmr)

Matrix Multiplication on data.frames

mm() accepts two data.frame’s and returns their matrix product:

x <- data.frame(a=c(1,2,3), b=c(5,6,7))
y <- c(2,2)
mm(x, y)
##   V1
## 1 12
## 2 16
## 3 20

%mm% offers the same functionality in infix form:

x <- data.frame(a=c(1,2,3), b=c(5,6,7))
y <- c(2,2)
x %mm% y
##   V1
## 1 12
## 2 16
## 3 20