[rkward-devel] Fwd: [rkward-users] Proposition of changes on crosstabulation plugin

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Sat Apr 2 08:17:53 UTC 2011


On Friday 01 April 2011, Andrés Necochea wrote:
> I, don't make significative changes. I add the arguments row.vars and
> col.vars, thats are pased to ftable function.

Makes sense. On the other hand, thinking about it, I guess the conversion to 
ftable() does not belong into the bind.tables() function at all. It's merely 
something to format the table for printing.

So, instead, I think the basic pattern should be

  output[[i]] <- bind.tables ("counts"=..., "% or row"=...)
  rk.print (ftable (output[[i]], col.vars=2))
  

> At now it can calculate the percents, and add sums at margins,

I think you can simplify the addition of margins by using the "margin"-
parameter of addmargins. Then you would not need to add margins to each 
statistic, separately, but rather
  addmargins (output[[i]], margin=1:2)
(untested).

Also, the rounding can probably be done for the whole table at once, rather 
than separately for each statistic.

With that, probably you can also do away with "tables.row", "tables.column", 
etc. Rather use something like
  echo ('output[[i]] <- bind.tables ("counts"=results[[i]]');
  if (getValue ("row") == "TRUE") echo (',\n  "% of row"=
                    prop.table(results[[i]], 1) * 100');
  [...]
  echo (')');

> I think that
> it could calculate the cumsum, but I don't know how to put cumsum with
> addmargins function.

Good question.

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20110402/e1d1f295/attachment.sig>


More information about the Rkward-devel mailing list