On Mon, 13 Feb 2006, J. Hosking wrote:
> > addmargins(UCBAdmissions, FUN = list(Total=sum))
>
> works with no problems, but consider:
>
> > myFUN <- list(Total=sum)
> > addmargins(UCBAdmissions, FUN = myFUN)
> Error in "names<-.default"(`*tmp*`, value = "") :
> names() applied to a non-vector
>
> Is this a bug?
I believe so. addmargins contains
FUN <- eval(add.names(substitute(FUN)))
and that only makes sense if FUN is a call and not a symbol. I've made
the appropriate change to R-devel.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595