fPortfolio 包中的 R 错误:找不到函数“tclVar”

问题描述

我加载了带有预安装数据框的 fPortfolio:

library(fPortfolio)
library(PerformanceAnalytics)

data("edhec")

rets <- edhec

# compute the tangency portfolio
tp <- tangencyPortfolio(as.timeSeries(edhec))

frontier <- portfolioFrontier(as.timeSeries(edhec))
#plot(frontier) # Plots frontier,don't need this

# The problem is when I run this code:
weightsSlider(object = frontier,control = list())

当我运行最后一行时,weightsSlider 出现错误

Error in tclVar(starts[i]) : Could not find function "tclVar"

一个单独的窗口打开,上面写着“窗口滑块”。

如果我跑:

capabilities()["tclVar"]

我收到错误

<NA> 
 NA

当我跑步时:

tcltk::tclVar

我收到错误

function (init = "") 
{
    n <- .TkRoot$env$TclVarCount <- .TkRoot$env$TclVarCount + 
        1L
    name <- paste0("::RTcl",n)
    l <- list(env = new.env())
    assign(name,NULL,envir = l$env)
    reg.finalizer(l$env,function(env) tcl("unset",names(env)))
    class(l) <- "tclVar"
    tclvalue(l) <- init
    l
}
<bytecode: 0x000001b271b9ddd0>
<environment: namespace:tcltk>

我安装了 tcltcltk2 软件包。


fPortfolio rdocumentation

fPortfolio github

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)