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

178 Views Asked by At

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

0

There are 0 best solutions below