Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
598 views
in Technique[技术] by (71.8m points)

R error in fPortfolio package: could not find function "tclVar"

I load fPortfolio with a pre-installed data frame attached:

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())

When I run the last line, weightsSlider I get an Error:

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

A separate window opens up that says 'window slider'.

If I run:

capabilities()["tclVar"]

I get the error:

<NA> 
 NA

And when I run:

tcltk::tclVar

I get the error:

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>

I installed both the tcl and the tcltk2 packages.


fPortfolio rdocumentation

fPortfolio github


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...