Hi all.

I am currently attempting to build a list of sparse matrixes. That I have
already achieved, by

> vmat <- list()
> for (i in 1:n) {
>   vmat <- c(vmat, sparseMatrix(i,j,x=data)
> }

How I am trying to select those elements from the list where the column e.g.
999 is not null. I can do this for one of the sparse matrices with

> which(vmat[[1]][,999] != 0)

which returns the rows where such column is non-zero.

However, my purpose is to obtain the list indices of the sparse matrices
with such non-zero elements. I tried things like

which(vmat[[]][,999] != 0)
which(vmat[,,999] != 0)
sapply(vmat, which, [,999] != 0)

but none worked... any help will be appreciated!!

Cheers,

Germán

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to