[R] accessing a table

Jonathan Baron baron at cattell.psych.upenn.edu
Tue Jul 10 21:38:18 CEST 2001


>From: Greg Trafton <trafton at itd.nrl.navy.mil>
>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).

currenttable[1,2]

or even

table(junk[-1],junk[-n])[1,2]

Jon Baron
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list