Revision 69d148ddb24d5cb53bce843f0f63e388b903fcbd authored by Bendix Carstensen on 22 May 2010, 05:22:26 UTC, committed by cran-robot on 22 May 2010, 05:22:26 UTC
1 parent 1c180cf
Raw File
pctab.R
pctab <- function( TT, margin=length( dim( TT ) ), dec=1 )
  {
  nd <- length( dim( TT ) )
  sw <- (1:nd)[-margin[1]]
  rt <-
  sweep( addmargins( TT,
                     margin,
                     list( list( All=sum,
                                   N=function( x ) sum( x )^2/100 ) ) ),
         sw,
         apply( TT,
                sw,
                sum )/100,
         "/" )
  print( round( rt, dec ) )
  invisible( rt )
  }
back to top