Skip to content

improve matrix conformability error message

1 message · Joshua N Pritikin

#
Incorrect code,

A <- matrix(1, 2, 2)
B <- matrix(2, 3, 2)
A %*% B

Produces

  Error in A %*% B : non-conformable arguments

It would be helpful to show the matrix dimensions,

  Error in A %*% B : non-conformable arguments of dimensions (2, 2) and (3, 2)