我试图在我自己的C
脚本中调用R
(默认安装)为HoltWinters
提供的HoltWinters
函数,但得到消息:
Error in hw(alpha, beta, gamma) : object 'C_HoltWinters' not found
我的R脚本中的部分代码是:
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)
)
根据我的初步研究,我们需要使用dyn.load(dllName);
。
我现在有两个问题:
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?
发布于 2014-03-18 11:18:13
C_HoltWinters
对象不是从stats
命名空间导出的。您可以使用stats:::C_HoltWinters
引用它。
请注意,这违反了CRAN策略,所以如果您将其放入计划提交给CRAN的包中,则不允许这样做。
https://stackoverflow.com/questions/22488682
复制