Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.GSO.4.05.10107101527530.24537-100000@virga.rap.ucar.edu>
Date: 2001-07-10T21:29:01Z
From: Claudia Tebaldi
Subject: accessing a table
In-Reply-To: <15179.19216.297701.228590@viz.itd.nrl.navy.mil>

On Tue, 10 Jul 2001, Greg Trafton wrote:

> Hi, all.  I'm sure this is a simple question, but I'm having problems
> figuring it out myself...  I have a table:
> 
> > currenttable <- table(junk[-1],junk[-n])
> > currenttable
>       
>        bar foo junk
>   bar    2   2    0
>   foo    1   0    0
>   junk   0   0    1
> 
> and I'd like to know the result of the cell currenttable(bar,foo).
> 
> what is the best way to get that result?
> 
> thanks!
> greg
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 

currenttable[match("bar",dimnames(currenttable)[[1]]),
             match("foo",dimnames(currenttable)[[2]])]


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._