[R] inverting a table

David Winsemius dwinsemius at comcast.net
Sun Apr 5 22:17:58 CEST 2009


?t  # I knew it worked with matrices so seemed reasonable to see if it  
worked on tables.

 > t(with(warpbreaks, table(wool, tension)) )
        wool
tension A B
       L 9 9
       M 9 9
       H 9 9
 > with(warpbreaks, table(wool, tension))
     tension
wool L M H
    A 9 9 9
    B 9 9 9

On Apr 5, 2009, at 3:56 PM, Donald Braman wrote:

> Is there an easy way to invert a table?  (not to solve for the  
> inverted
> matrix, just swap rows for columns & vice versa).  I've gone through  
> my data
> manipulation bible (Phil Spector's book), but to no avail.
>
> 	[[alternative HTML version deleted]]

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list