Histogram of large matrix in R
I have a large, square sparse matrix in R (about 30M real numbers), and I'd like to see the distribution of its values. If I use the hist function, as most values are 0, I get a very tall first bar and then a very long tail very close to 0, something like: I______
So I guess I should print only nonzero values, or rescale the values in order to show the pattern of non zero values in a meaninful 开发者_JS百科way. Is there a way to tell hist to filter out certain values? I'd like to include only values in (0,1).
A matrix is just a vector that's been told about it's column and row assignments... it'll turn back into one if you just treat it like one. .....
hist( myMatrix[myMatrix > 0 & myMatrix < 1] )
精彩评论