0

I am following code from this guidebook, https://www.adb.org/sites/default/files/publication/698091/guidebook-mapping-poverty-data-integration-ai.pdf

And inputted wd <- tcltk::tk_choose.dir(caption ="Select Working Directory") into R but received the error message Error in structure(.External(.C_dotTclObjv, objv), class = "tclObj") : [tcl] invalid command name "tk_chooseDirectory".

When I changed it to wd <- tcltk::tk_chooseDirectory(caption ="Select Working Directory")

I get the error Error: 'tk_chooseDirectory' is not an exported object from 'namespace:tcltk'.

The only lines of code I have before these are installing packages, but since tcltk is a base package of R, it's unlikely that's the problem.

How do I solve this? Thank you! I've attached a photo of the example code.

What the guide code should look like

Phil
  • 7,287
  • 3
  • 36
  • 66
  • I have tried `wd <- tcltk::tk_choose.dir(caption ="Select Working Directory")` on my machine and everything is OK. The same problem is described here: https://stackoverflow.com/questions/48730353/invalid-command-name-tk-choosedirectory-error, but no solution is available. Are you using RStudio desktop or server / cloud? – gss Nov 23 '21 at 08:05
  • Hmm,, I'm using RStudio desktop – codinggirl123 Nov 23 '21 at 08:11
  • Thanks. I don't see solution, I can just add that I use RStudio desktop as well, Windows 10, R 4.1.1, RStudio 1.4.1717 and I don't have Autodesk software (https://newbedev.com/os-independent-way-to-select-directory-interactively-in-r) :) – gss Nov 23 '21 at 08:18
  • Sounds like something is mis-installed, with the scripted parts of Tk not being properly found. Did you move the installation? If you did, you broke things. ([`tk_chooseDirectory`](https://www.tcl-lang.org/man/tcl8.4/TkCmd/chooseDirectory.htm) is available in Tk 8.4, so versioning shouldn't be a problem. Unless you're using something absolutely ancient, but the older code gets harder to build for modern systems.) – Donal Fellows Nov 23 '21 at 08:57

0 Answers0