Skip to content

problem accessing complex list data frames

2 messages · Germán Sanchis, Nick Sabbe

#
Hello Germ?n.

You probably want something like:
sapply(vmat, function(curMat){
		curMat[,999] != 0
	})
Or if you want the indices, just surround this with a which.

HTH.

Nick Sabbe
--
ping: nick.sabbe at ugent.be
link: http://biomath.ugent.be
wink: A1.056, Coupure Links 653, 9000 Gent
ring: 09/264.59.36

-- Do Not Disapprove



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Germ?n Sanchis
Sent: woensdag 8 december 2010 11:50
To: r-help at r-project.org
Subject: [R] problem accessing complex list data frames

Hi all.

I am currently attempting to build a list of sparse matrixes. That I have
already achieved, by
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 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,

German