我加载 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>
我安装了 thetcl
和tcltk2
软件包。