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
predict(x,
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
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.