[Rd] Multiple return values / bug in rpart?

Terry Therneau therneau at mayo.edu
Tue Aug 13 14:54:35 CEST 2013


I don't remember what rpartpl once did myself; as you point out it is a routine that is no 
longer used and should be removed.  I've cc'd Brian since he maintains the rpart code.

Long ago return() with multiple arguments was a legal shorthand for returning a list.  
This feature was depricated in Splus, I think even before R rose to prominence.  I vaguely 
remember a time when it's usage generated a warning.

The fact that I've never noticed this unused routine is somewhat embarrassing.  Perhaps I 
need a "not documented, never called" addition to R CMD check to help me along.

Terry Therneau

> In the recommended package rpart (version 4.1-1), the file rpartpl.R
> contains the following line:
>
> return(x = x[!erase], y = y[!erase])
>
> AFAIK, returning multiple values like this is not valid R. Is that
> correct? I can't seem to make it work in my own code.
>
> It doesn't appear that rpartpl.R is used anywhere, so this may have
> never caused an issue. But it's tripping up my R compiler.
>
> Thanks,
> Justin Talbot



More information about the R-devel mailing list