> From: Martin Maechler <maech...@lynne.stat.math.ethz.ch>

> diag() should not work only for pure matrices, but for all
> "matrix-like" objects for which ``the usual methods'' work, such
> as
>    as.vector(.), c(.)
> 
> That's why there has been the c(.) in there.
> 
> You can always make code faster if you write the code so it only
> has to work in one special case .. and work there very fast.

help(diag) gives no hint whatever that diag(x) will work for
objects that are "matrix-like", but aren't actual matrices.

help(c) explicitly says that methods for it are NOT required to
convert matrices to vectors.

So you're advocating slowing down all ordinary uses of diag to
accommodate a usage that nobody thought was important enough to
actually document.

   Radford Neal

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to