Re: [Rd] addmargins

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue 14 Feb 2006 - 15:19:34 GMT

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@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

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed Feb 15 02:21:25 2006

This archive was generated by hypermail 2.1.8 : Wed 15 Feb 2006 - 06:37:18 GMT