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
2 matches
Mail list logo