Skip to content
Prev 32132 / 398506 Next

Newbie hung up with matrices

rwatkins at cornerstonelp.com wrote:
> A <- matrix(c(1,4,7,2,5,8,3,6,9), ncol=3, byrow=TRUE)
 > x <- c(3,5,6)
 > x%*%A
      [,1] [,2] [,3]
[1,]   31   73  115

The result of read.csv is not a matrix, so try the following:

A <- as.matrix(A)
x%*%A

hope this helps,

Chuck Cleland