Description Usage Arguments Value Author(s) Examples
Pushes the smaller values (in absolute value) to zero to achieve a certain nonzero ratio. In other words, the nonzero values closest to zero are assigned zero to achieve at least the specified nonzero ratio.
1 | sparseThreshold(z, nzr=.1)
|
z |
a sparse vector or matrix |
nzr |
the desired nonzero ratio |
Returns the variable z, with more or equal nonzero elements to achieve at least a nonzero ratio of nzr
Michael Love
1 2 3 4 | sds <- simulateSparseDataSet(100, c(5,5), nzs=.5, nzg=.3)
nnzero(sparseData(sds))/prod(dim(sds))
sparseData(sds) <- sparseThreshold(sparseData(sds), .1)
nnzero(sparseData(sds))/prod(dim(sds))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.