Reputation: 66637
I am trying to call C
function provided by R
(default installation) for HoltWinters
in my own R
script, but getting message:
Error in hw(alpha, beta, gamma) : object 'C_HoltWinters' not found
And part of the code in my R script is:
hw <- function(alpha, beta, gamma)
.C(C_HoltWinters,
as.double(x),
lenx,
as.double(max(min(alpha, 1), 0)),
as.double(max(min(beta, 1), 0)),
as.double(max(min(gamma, 1), 0)),
as.integer(start.time),
## no idea why this is so: same as seasonal != "multiplicative"
as.integer(! + (seasonal == "multiplicative")),
as.integer(f),
as.integer(!is.logical(beta) || beta),
as.integer(!is.logical(gamma) || gamma),
a = as.double(l.start),
b = as.double(b.start),
s = as.double(s.start),
## return values
SSE = as.double(0),
level = double(len + 1L),
trend = double(len + 1L),
seasonal = double(len + f)
)
Based on my preliminary research, it seems we need to use dyn.load(dllName);
I have 2 questions now:
1) How can I find out `dll` name for this function?
2) If I run default `HoltWinters.R` we don't need to load `dll`, then why it is required load `dll` in my custom script case?
Upvotes: 0
Views: 249
Reputation: 176638
The C_HoltWinters
object is not exported from the stats
namespace. You can reference it using stats:::C_HoltWinters
.
Do note that this is against CRAN policy, so it won't be allowed if you put this into a package you plan to submit to CRAN.
Upvotes: 1