Skip to content
Back to formatted view

Raw Message

Message-ID: <03d001cbb889$7c0e8db0$742ba910$@sabbe@ugent.be>
Date: 2011-01-20T10:04:53Z
From: Nick Sabbe
Subject: Using a list as multidimensional indexer

Hello list.

Another 'puzzle' for which I don't have a clean solution.
Say I have a multidimensional object, e.g.:
Mm<-matrix(1:6, nrow=2, dimnames=list(c("a","b"), c("g","h","i")))
And on the other hand I have a list
Ind<-list("b","g")
This holds, for each dimension, an indexer for that dimension.
Now I would like to get the element pointed at by the list.
The obvious solutions don't seem to work, and I can't seem to get do.call to
call the indexer ('[') on my multidimensional object.

Any suggestions?

Thanks in advance,

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