From ripley@stats.ox.ac.uk  Fri Aug 21 18:37:01 1998
From: ripley@stats.ox.ac.uk (Prof Brian D Ripley)
Date: Fri, 21 Aug 1998 18:37:01 +0100 (BST)
Subject: couldn't find FUN
In-Reply-To: <98Aug21.122130edt.13441@mailgate.bank-banque-canada.ca>
Message-ID: <Pine.GSO.3.96.980821182855.4962E-100000@localhost>

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="-", ...)

Arguments:

       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,                  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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


couldn't find FUN
Prof Brian D Ripley