couldn't find FUN

Prof Brian D Ripley
Fri, 21 Aug 1998 18:37:01 +0100 (BST)

On Fri, 21 Aug 1998, Paul Gilbert wrote:

> The call to sweep in this function which was working in 0.62.2 is giving me
> trouble in 62.3:

The call is invalid:

> ?sweep

Sweep out Array Summaries

     sweep(x, MARGIN, STATS, FUN="-", ...)


       x: an array.

> class(crimes)
[1] "data.frame"

If you call sweep on a data frame, as in

> sweep(crimes, 2, "-")

it does not work: it should not have done so before.  On the other hand, in
0.62.2, valid arithmetic operations on data frames gave matrices,
which helped your illegal example but were incorrect on legal ones.
You need an as.matrix in your code, I believe.

This example also fails in S.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: