Get Started →
Type & Coercion Errors

Non-conformable arguments

Matches: non-conformable arguments

WHAT THIS ERROR MEANS

Matrix multiplication or a similar operation failed because the dimensions don't match. The number of columns in the first matrix must equal the number of rows in the second.

HOW TO FIX IT

1. Check dimensions with dim().

2. For matrix multiplication A %*% B: ncol(A) must equal nrow(B).

3. Transpose with t() if needed.

CODE EXAMPLES

BAD — THIS CAUSES THE ERROR
A <- matrix(1:6, nrow = 2)
B <- matrix(1:4, nrow = 2)
A %*% B  # 2x3 times 2x2 fails
GOOD — CORRECT APPROACH
A <- matrix(1:6, nrow = 2)
B <- matrix(1:6, nrow = 3)
A %*% B  # 2x3 times 3x2 works

Still stuck?

Paste your code in RChat and the AI will fix this error in context.

Try RChat Free →

RELATED TYPE & COERCION ERRORS