I was asked if I could "fix" the R script that was created in version 3.2.2 that ceased to work in version 4.2.2.
The script turned out to be Tcl/tk interface using tcltk
package. The script starts with tclRequire("BWidget")
and tclRequire("Tktable")
.
GUI it produce is basically,
- import csv
- select one of column using drop-down
- second drop-down menu shows the levels of the above column
- do analysis
The problem occurs in number 3, where the drop-down menu is just blank with no selection available when using more recent R version.
While using a same system (Window OS), when using R version 3.2.2, it returns
> tclRequire("BWidget")
<Tcl> 1.8
> tclRequire("Tktable")
<Tcl> 2.9
while using R version 4.2.2 returns
> tclRequire("BWidget")
<Tcl> 1.9.15
> tclRequire("Tktable")
<Tcl> 2.10
It's my first time hearing what Tcl/Tk is, and it seemed the discrepancy in Tcl is the culprit, not the R per se.
I read https://stat.ethz.ch/R-manual/R-devel/library/tcltk/html/TclInterface.html and tried to play around with
addTclPath(path = ".")
tclRequire(package, warn = TRUE)
tclVersion()
but wasn't sure how to do it properly.
Is there a way to specify Tcl to 1.8 and 2.9 even when I am using other version of R?
require(tcltk)
thenaddTclPath("C:\\Users\\user.name\\Documents\\R\\R-3.2.2\\Tcl\\lib")
.strsplit(tclvalue('auto_path'), " ")[[1]]
returned vector length of 8 with the above directory as the 8th.tclRequire("BWidget")
still returns<Tcl> 1.9.15
, however. I am uncertain how I can make the directory specified as "priority" pathaddTclPath("C:\\Users\\user.name\\Downloads")
.tclRequire("BWidget2")
returnsIn tclRequire("BWidget2") : Tcl package 'BWidget2' not found