[R] Trying to extract an algorithm from a function

David Winsemius dwinsemius at comcast.net
Wed Dec 29 22:04:23 CET 2010


On Dec 29, 2010, at 3:31 PM, CALEF ALEJANDRO RODRIGUEZ CUEVAS wrote:

> Hi, I'm using package "vars" and I'm trying to extract the algorithm  
> that
> function "predict" contained in that package in order to understand  
> how does
> it work.
>
> When I type function "VAR" then all its algorithm appears in R,  
> however if I
> try to do the same with "predict" nothing happens...Is there any  
> possible
> way to extract the algorithm?

With the package loaded do this to an object to which you are  
submitting to predict
class(object)

Then do"

methods(predict)

If your <class>.predict function has a "*" by it then do this:

getAnywhere(<class>.predict)

And if you are using a package that uses S4 methods, good luck.
--

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list