Re: [R] What exactly is an dgCMatrix-class. There are so many attributes.

2017-10-21 Thread Martin Maechler
> David Winsemius > on Sat, 21 Oct 2017 09:05:38 -0700 writes: >> On Oct 21, 2017, at 7:50 AM, Martin Maechler wrote: >> >>> C W >>> on Fri, 20 Oct 2017 15:51:16 -0400 writes: >> >>> Thank you for your responses. I guess I don't feel >>> alone

Re: [R] What exactly is an dgCMatrix-class. There are so many attributes.

2017-10-21 Thread Martin Maechler
> C W > on Fri, 20 Oct 2017 16:01:06 -0400 writes: > Subsetting using [] vs. head(), gives different results. > R code: >> head(train$data, 5) > [1] 0 0 1 0 0 The above is surprising ... and points to a bug somewhere. It is different (and correct) after you do re

Re: [R] What exactly is an dgCMatrix-class. There are so many attributes.

2017-10-21 Thread David Winsemius
> On Oct 21, 2017, at 7:50 AM, Martin Maechler > wrote: > >> C W >>on Fri, 20 Oct 2017 15:51:16 -0400 writes: > >> Thank you for your responses. I guess I don't feel >> alone. I don't find the documentation go into any detail. > >> I also find it surprising that, > >>> object.s

Re: [R] What exactly is an dgCMatrix-class. There are so many attributes.

2017-10-21 Thread Martin Maechler
> C W > on Fri, 20 Oct 2017 15:51:16 -0400 writes: > Thank you for your responses. I guess I don't feel > alone. I don't find the documentation go into any detail. > I also find it surprising that, >> object.size(train$data) > 1730904 bytes >> object.size(a

Re: [R] What exactly is an dgCMatrix-class. There are so many attributes.

2017-10-20 Thread C W
Subsetting using [] vs. head(), gives different results. R code: > head(train$data, 5) [1] 0 0 1 0 0 > train$data[1:5, 1:5] 5 x 5 sparse Matrix of class "dgCMatrix" cap-shape=bell cap-shape=conical cap-shape=convex [1,] . .1 [2,] .

Re: [R] What exactly is an dgCMatrix-class. There are so many attributes.

2017-10-20 Thread C W
Thank you for your responses. I guess I don't feel alone. I don't find the documentation go into any detail. I also find it surprising that, > object.size(train$data) 1730904 bytes > object.size(as.matrix(train$data)) 6575016 bytes the dgCMatrix actually takes less memory, though it *looks* li

Re: [R] What exactly is an dgCMatrix-class. There are so many attributes.

2017-10-20 Thread David Winsemius
> On Oct 20, 2017, at 11:11 AM, C W wrote: > > Dear R list, > > I came across dgCMatrix. I believe this class is associated with sparse > matrix. Yes. See: help('dgCMatrix-class', pack=Matrix) If Martin Maechler happens to respond to this you should listen to him rather than anything I wri

Re: [R] What exactly is an dgCMatrix-class. There are so many attributes.

2017-10-20 Thread William Dunlap via R-help
You should not really have worry about the internal structure of such a thing - just treat it like a matrix. E.g., > train$data[1:3,1:3] # dots mean 0's 3 x 3 sparse Matrix of class "dgCMatrix" cap-shape=bell cap-shape=conical cap-shape=convex [1,] . .

[R] What exactly is an dgCMatrix-class. There are so many attributes.

2017-10-20 Thread C W
Dear R list, I came across dgCMatrix. I believe this class is associated with sparse matrix. I see there are 8 attributes to train$data, I am confused why are there so many, some are vectors, what do they do? Here's the R code: library(xgboost) data(agaricus.train, package='xgboost') data(agari