[R] Tables package - remove NAs and NaN

Liviu Andronic landronimirc at gmail.com
Tue Apr 23 15:04:39 CEST 2013


Dear Duncan,

On Tue, Apr 23, 2013 at 2:13 PM, Duncan Murdoch
<murdoch.duncan at gmail.com> wrote:
> I've done this now, in version 0.7.54 on R-forge.  To leave out the rows
> with N=0, you can select a subset of the table where N (the first column) is
> non-zero:
>
> tab <- tabular(((p=factor(p))*(a=factor(a))+1) ~ (N = 1) + (b +
> c)*(mean+sd),data=q)
>
> tab[ tab[,1] > 0, ]
>
> and it produces this:
>
>
>          b           c
>  p a   N  mean  sd    mean sd
>  A 1   10 16.20 3.458 56.3 10.155
>    3   10 13.60 2.119 58.1  8.075
>  B 2   10 14.40 2.547 51.2  9.438
>    All 30 14.73 2.888 55.2  9.419
>
> Indexing of tables isn't as general as indexing of matrices, but most of the
> simple forms should work.  I haven't tested yet, but I expect this will be
> fine in LaTeX or HTML (also new, not on CRAN yet) output as well.
>
Thank you so much for adding this. I've installed 0.7.54 and it seems
to work as advertised. The LaTeX output looks flawless, too.

Regards,
Liviu



More information about the R-help mailing list