On Fri, 21 Oct 2016, Sven Schreiber wrote:
Am 21.10.2016 um 16:38 schrieb Allin Cottrell:
>
> I don't know enough about R's sparse matrices to say exactly what the
> 'matrix' returned by fcheck consists of, but it looks kinda
> funny if you print it in R itself:
> m1
> [,1]
> [1,] 0.8048351
> [2,] -0.9528827
> [3,] 1.42894
> [4,] ?
> </R>
Well but that seems to stem from "glueing" together the two matrices with
non-matching dimensions.
Yes: that doesn't provoke an error in R, but it's not clear to me
what the result really is.
If you directly look at the initial sparse matrix in
R, here's what I get:
2 x 3 sparse Matrix of class "ngCMatrix"
[1,] . | .
[2,] . . |
The fact that there's missings in there is due to the incomplete
initialization, where only the locations of the non-zeros were specified, not
their values.
So if I use rbind() on a mixture of sparse and dense matrices in R, I get:
<R-sessionpart>
> m3 <- sparseMatrix(c(1,2), c(2,3))
> m4 <- matrix(rnorm(3), ncol=3)
> rbind(m3, m4)
3 x 3 sparse Matrix of class "dgCMatrix"
[1,] . 1.0000000 .
[2,] . . 1.000000
[3,] -1.934421 -0.6477288 1.069744
</R-sessionpart>
Apparently R then automatically puts defaults (1.0) into the missing places.
The transfer to gretl then works fine.
Ok, that's good to know.
Allin