I would suggest you look into the Matrix package.
Here's an example that illustrates what I suspect is the root cause of
your issue:
> x <- matrix(1:4, ncol=2)
> class(x)
[1] "matrix"
> y1 <- x[,1]
> class(y1)
[1] "integer"
> y1
[1] 1 2
> y2 <- x[,1,drop=FALSE]
> class(y2)
[1] "matrix"
> y2
The actual types of data you have are critical to understanding your problem,
and you have not provided that information. [1] What looks like a matrix isn't
always, and in R vectors do not have a "column" or "row" nature, so matrix
multiplication is not necessarily well-defined. To get consisten
I had trouble with matrix multiplication when a matrix reduces to a
vector. In the following, lines 1 and 2 work when matrices u and a are
both of order 2.
Lines 3 and 5 do not work (message is matrix not conformable) when u is (T
x 1) and a is (1 x 2) and This causes a problem for users of other
3 matches
Mail list logo