Read the source code of function R, including C

Suppose I wonder how the R function works, say HoltWinters . I typed HoltWinters and it shows me the source of R for the function. When checking, the source shows that the function is a wrapper around the second function:

  final.fit <- hw(alpha, beta, gamma) 

Presumably, serious work is going on in the hw function. However, I cannot find this function anywhere to read its source.

 > hw Error: object 'hw' not found 

How can I read the source?


Edit: Ok, now I read hw , I see a wrapper around C_HoltWinters . How can I read this?

+4
source share
1 answer

As you have successfully found, there are lines

 hw <- function(alpha, beta, gamma) .C(C_HoltWinters, .... 

in the source of the HoltWinters function. This means that we need to look at the C files: you can find all of the R source code here, or just go here .

+6
source

All Articles