[Rd] delete.response() incorrectly handles terms-objects (PR#1328)

ripley@stats.ox.ac.uk ripley@stats.ox.ac.uk
Mon, 25 Feb 2002 16:50:35 +0100 (MET)


On Mon, 25 Feb 2002, David Meyer wrote:

> Prof Brian D Ripley wrote:
> >
> > Thanks, fixed now.
> >
> > Why were you calling delete.response on an object with no response, BTW?
>
> I used it in predict.svm(), and the terms-object contained in the svm
> model just happens to have no response for the ``one-class
> classification'' if svm was called e.g. by:
>
> m <- svm(~a+b).
>
> Because of the second line in delete.response()
>
>     if (length(f) == 3)
>         f[[2]] <- NULL
>
> handling the no-response case, I believed I was allowed to use
> delete.response() without checking for this.

Indeed you were. But delete.response does change the terms object in that
case, and I suspect it should either return it unchanged (as S does) or
give an error.

> > I wonder whether delete.response should not be a no-op in that case (it is
> > in S), if there is any reason to handle it at all.
>
> So people will have to check for it before using delete.response() -
> this is probably more secure indeed.

-- 
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._