[R] get the value of a biplane

Duncan Murdoch murdoch.duncan at gmail.com
Mon May 29 22:16:53 CEST 2017

On 29/05/2017 3:15 PM, Jeff Newmiller wrote:
> Well, then I will hedge by saying that IN MY OPINION it is an error, because when it isn't exported the arguments not specified in the generic cannot be visible for argument completion in editors.

But that's not true.  If you want the arguments , use

args(getS3method("predict", class(x)))

where x is your bs() object.  RStudio appears to make use of something 
like this.  R.app on MacOS and Rgui on Windows does something different, 
I think not as effectively. I don't know about other editors.

(BTW, I think the getS3method function has a bug:  if you change the x 
object to have class c("foobar", class(x)), it *does* fail, even though 
predict(x, ...)  will still work.)

  The predict.lm function specifies new data with the newdata argument, 
while the predict.bs function specifies it with the newx argument. 
Invoking with the generic is supposed be useful when trying out a 
variety of models, but being unable to generically specify a data frame 
(due to the inconsistent naming) blows that strategy to pieces anyway so 
you might as well be able to call the functions explicitly.

In RStudio, if you set x <- bs(1:10), then type


and hit TAB, you are offered "object", "newx" and "..." as choices.  On 
the other editors I mentioned you appear to get a list of argument names 
for all possible methods regardless of the class of x.

Duncan murdoch

More information about the R-help mailing list