Skip to content
Prev 33786 / 63424 Next

Problem in matrix definition?

Dear Fabio,

The problem is that L[k,1:(r-1)] is not anymore a matrix but a vector.
Hence when you do t(L[k,1:(r-1)]) you get a matrix with only one row
while I think you expected one column instead. You can see this feature
with a simpler example like the following one:

        x <- runif(10)
        is.vector(x)
        dim(t(x))##1,10
        dim(t(t(x)))##10,1

Getting back to your code, you probably want that L[k,1:(r-1)] is a
matrix with r-1 columns. This is possible by substituting
t(L[k,1:(r-1)]) for t(t(L[k,1:(r-1)])) or matrix(L[k,1:(r-1)], nrow = 1)

Maybe somebody else will find a more elegant fix for your problem.
However, I tried and it did solve your issue.

Cheers,
Mathieu

Le lundi 31 ao?t 2009 ? 19:09 +0200, Fabio Mathias Corr?a a ?crit :