Hi: I've looked around and I must be missing it because it's probably
somewhere. Does someone know how to convert an object of class dgCmatrix
to a regular matrix. I can send someone the data if they need it but it's
too big to include here.
I read the data in using
temp<-readMat("movielens.mat")
where readMat is from the R.matlab package. But the resulting 2 matrices
are S4 object of class dgCmatrix with 6 slots shown below. In the end, I'd
actually want to put the 18000 elements of the second matrix into the
appropriate locations of the first matrix ( first one has missings or zeros
in those places. Not sure which yet ) but first things first !!!!!!!!!
Thanks a lot.
#======================================================================================================
temp <- readMat("movielens.mat")> print(str(temp))
List of 2
$ x:Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
.. ..@ i : int [1:982089] 0 47 144 253 513 517 574 580 581 593 ...
.. ..@ p : int [1:6041] 0 50 176 224 242 437 505 533 669 772 ...
.. ..@ Dim : int [1:2] 3706 6040
.. ..@ Dimnames:List of 2
.. .. ..$ : NULL
.. .. ..$ : NULL
.. ..@ x : num [1:982089] 5 5 5 4 5 4 4 4 5 4 ...
.. ..@ factors : list()
$ v:Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
.. ..@ i : int [1:18120] 708 964 1782 466 2160 2512 1178 1483 2785
971 ...
.. ..@ p : int [1:6041] 0 3 6 9 12 15 18 21 24 27 ...
.. ..@ Dim : int [1:2] 3706 6040
.. ..@ Dimnames:List of 2
.. .. ..$ : NULL
.. .. ..$ : NULL
.. ..@ x : num [1:18120] 3 5 4 5 4 3 3 5 3 4 ...
.. ..@ factors : list()
- attr(*, "header")=List of 3
..$ description: chr "MATLAB 5.0 MAT-file, Platform: GLNXA64, Created on:
Tue Mar 18 18:21:21 2008 "
..$ version : chr "5"
..$ endian : chr "little"
NULL>
[[alternative HTML version deleted]]