[R] How to view the code of a method?

2007-10-02 Thread Strong
Dear All 

I am a biginner of R.

I have difficulty with reading the code of a method.   

I am using the vars package to estimate a VAR model and I want to view the code 
of predict method for objects with class attribute varest. 

I thougt I could just type the name predict without anything to display the 
code of the method as I often do with generic function. However, I got the 
following messages:

function (object, ...) 
UseMethod(predict)
environment: namespace:stats

I cannot figure out the meaning that the above message want to deliver to me 
and thus cannot find a way to view the code of the predict method with class 
varest. 

Can anyone help me out?

Thanks in advance.  


Strong Chen

__
R-help@r-project.org mailing list
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.


Re: [R] How to view the code of a method?

2007-10-02 Thread Stefano Calza
For S3 methods I'd try something like

methods(predict)

 [1] predict.ar*predict.Arima* predict.arima0*  
  predict.glm   
 [5] predict.HoltWinters*   predict.lm predict.loess*   
  predict.mlm   
 [9] predict.nls*   predict.poly   predict.ppr* 
  predict.prcomp*   
[13] predict.princomp*  predict.smooth.spline* 
predict.smooth.spline.fit* predict.StructTS* 

   Non-visible functions are asterisked


and then e.g.

predict.lm

or

getAnywhere(predict.ar)

for those Non-visible


HIH

Stef



On Tue, Oct 02, 2007 at 11:52:34PM +0900, Strong wrote:
StrongDear All 
Strong
StrongI am a biginner of R.
Strong
StrongI have difficulty with reading the code of a method.   
Strong
StrongI am using the vars package to estimate a VAR model and I want to view 
the code of predict method for objects with class attribute varest. 
Strong
StrongI thougt I could just type the name predict without anything to 
display the code of the method as I often do with generic function. However, I 
got the following messages:
Strong
Strongfunction (object, ...) 
StrongUseMethod(predict)
Strongenvironment: namespace:stats
Strong
StrongI cannot figure out the meaning that the above message want to deliver 
to me and thus cannot find a way to view the code of the predict method with 
class varest. 
Strong
StrongCan anyone help me out?
Strong
StrongThanks in advance.  
Strong
Strong
StrongStrong Chen
Strong
Strong__
StrongR-help@r-project.org mailing list
Stronghttps://stat.ethz.ch/mailman/listinfo/r-help
StrongPLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
Strongand provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
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.