> Dear Martin,
>
> Thank you for the perfect fix. It fixes both issues in the 1-dim case (i.e.
automatic dnn *and* disregard dnn/names in ...), as well as the documentation.
Finally, there is still a corner case that the patch did not fix in the 1D-case.
We cannot override the data frame's names with the dnn argument:
tab(warpbreaks[2], dnn = letters[1]) # dnn ignored
# wool
# A B
# 27 27
tab(warpbreaks[2:3], dnn = letters[1:2]) # works
# b
# a L M H
# A 9 9 9
# B 9 9 9
But I did not manage to fix it...
> While working on table, may be this should be an error?
>
> table(warpbreaks[2], warpbreaks[3])
> #
> # 1:3
> # 1:2 0
> # Warning messages:
> # 1: In xtfrm.data.frame(x) : cannot xtfrm data frames
> # 2: In xtfrm.data.frame(x) : cannot xtfrm data frames
>
> Best regards,
>
> Thomas
>
> > -----Message d'origine-----
> > De : Martin Maechler [mailto:maechler using stat.math.ethz.ch]
> > Envoy? : jeudi 14 octobre 2021 11:44
> > ? : SOEIRO Thomas
> > Cc : R Development List
> > Objet : Re: [Rd] Potential bugs in table dnn
> >
> > EMAIL EXTERNE - TRAITER AVEC PR?CAUTION LIENS ET FICHIERS
> >
> > Dear Thomas,
> >
> > actually, I have in the mean time already applied the changes I think
are
> > needed, both in the code and in the documentation.
> >
> > So, in this case, it may be a waste of time to still open a bugzilla
issue, I think.
> >
> > Here are my current changes (not yet committed; of course I would also
add
> > a NEWS entry, mentioning you):
> >
> >
> > Index: src/library/base/R/table.R
> > =========================================================> >
========> > 53c53
> > < if (length(dnn) != length(args))
> > ---
> > > if(length(args) == 1L || length(dnn) != length(args))
> > Index: src/library/base/man/table.Rd
> > =========================================================> >
========> > 23c23
> > < \code{table} uses the cross-classifying factors to build a
contingency
> > ---
> > > \code{table} uses cross-classifying factors to build a
contingency
> > 41c41,42
> > < (including character strings), or a list (or data frame)
whose
> > ---
> > > (including numbers or character strings), or a
\code{\link{list}} (such
> > > as a data frame) whose
> > 67c68,69
> > < If the argument \code{dnn} is not supplied, the internal
function
> > ---
> > > If the argument \code{dnn} is not supplied \emph{and} if
\code{\dots} is
> > > not one \code{list} with its own \code{\link{names}()}, the
internal
> > > function
> >
> >
> >
> > With regards,
> > Martin