[R] Tables package - remove NAs and NaN

Liviu Andronic landronimirc at gmail.com
Tue Apr 23 14:07:42 CEST 2013


Dear Duncan,
Thank you for your explanations.

On Tue, Apr 23, 2013 at 12:31 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> This isn't something that the package is designed to handle:  if you say
> p*a, it wants all combinations of p and a.
>
To your knowledge is there another 'complex tables' package that could
achieve this?


> If I wanted a table like that, I'd use a different hack.  One possibility is
> to create that interaction column, but display it as just the initial
> letter, labelled p, and then add another column to contain the a values as
> data.  It would be tricky to get the formatting right.
>
> Another possibility is to generate the whole table with the N=0 rows, and
> then post-process it to remove those rows, and adjust the row labels
> appropriately.  This approach probably gives the nicer result, but the
> post-processing is quite messy:  you need to delete some rows from the
> table, from its rowLabels attribute, and from the justification attributes
> of both the table and its rowLabels.  (I should add a [ method to the
> package to hide this messiness.)
>
I think a subsetting method would be useful, indeed.


> A third hack is less of a hack:  don't do that.  Just format the mean and sd
> in a way that displays the NA and NaN values as blanks.
>
I think this could work, at least for unofficial displays of the
summaries, but I'm not sure where to start from. What
function/argument should one use? Could you give an example?

Thank you,
Liviu



More information about the R-help mailing list