Skip to content

Issue with utils::choose.dir() function in RStudio version 2023.03.0 Build 386 after updating R #13078

Closed

Description

@PercyRvx
RStudio Edition : Desktop
RStudio Version : RStudio 2023.03.0+386 "Cherry Blossom" Release
OS Version      :  Windows 10 22H2 19045.2846
R Version       :  4.3.0

Dear RStudio Team,

I hope this message finds you well. I am writing to report an issue I have encountered while using RStudio version 2023.03.0 Build 386.

After updating the R engine to version 4.3.0, I have noticed that when I execute the function utils::choose.dir(), it returns NA without opening the folder selection window as expected. However, this issue does not occur when running the function in the R console outside of RStudio.

As a temporary workaround, I have found that if I first invoke the base::file.choose() function and then run choose.dir() within the same RStudio session, the folder selection window does appear.

I wanted to bring this matter to your attention, as it seems to be specific to RStudio and not to the R console itself. I hope that you can look into this issue and provide a resolution or guidance on how to address it.

Thank you for your continued support and for developing an excellent product. I look forward to hearing from you soon.

Best regards,

Percy Rodríguez

Activity

  1. kevinushey commented on May 2, 2023

    @kevinushey
    Collaborator

    Note for anyone investigating; choose.files() and choose.dir() are both functions only available on Windows builds of R.

  2. added
    new
    on May 12, 2023
  3. timtmok commented on May 30, 2023

    @timtmok
    Contributor

    This looks like a problem with Rterm.exe. I don't get the selection dialog.

    image

    If I use Rgui.exe then I do get the selection dialog.

    image

    Edit: It also works, as reported, after using file.choose().

  4. sjackson1997 commented on Aug 26, 2023

    @sjackson1997

    I got here because I'm experiencing the same problem. Apologize for ignorance, but I don't know what Rterm.exe is (is that what RStudio is running as a console?).

    FWIW, here's what I'm running:

    version
    _
    platform x86_64-w64-mingw32
    arch x86_64
    os mingw32
    crt ucrt
    system x86_64, mingw32
    status
    major 4
    minor 3.1
    year 2023
    month 06
    day 16
    svn rev 84548
    language R
    version.string R version 4.3.1 (2023-06-16 ucrt)
    nickname Beagle Scouts

    RStudio 2023.06.1+524 "Mountain Hydrangea" Release (547dcf8, 2023-07-07) for windows
    Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2023.06.1+524 Chrome/110.0.5481.208 Electron/23.3.0 Safari/537.36

  5. timtmok commented on Aug 28, 2023

    @timtmok
    Contributor

    @sjackson1997 Yes, RTerm.exe is how RStudio runs R. Thank you for your report. I don't think there's a workaround for this other than downgrading R.

    From my quick investigation, I think RGui works since it is meant to show a graphical interface. RTerm might not support this since it is supposed to be a terminal environment. Maybe the R update changed this behaviour because it aligns with the purpose for RTerm. It's unknown at this time if there's a solution for this.

  6. added this to the Backlog-2 milestone on Aug 28, 2023
  7. modified the milestones: Backlog-2, Later on Oct 5, 2023
  8. gagecarto commented on Oct 26, 2023

    @gagecarto

    Hi All - I've recently run into this issue as upgrading R broke some a Shiny app which depended on the choose.dir() function. Any suggestion on working around this? From what I am reading it sounds like this is a problem with R and thus R needs to be downgraded to fix the problem.

    Many thanks

  9. removed
    new
    on Dec 17, 2023
  10. ismirsehregal commented on Dec 18, 2023

    @ismirsehregal

    I also just came across this problem - same behaviour when using Rscript.exe, but I can't seem to find any "official" news about this.

    @gagecarto regarding shiny you might want to check:
    https://github.com/thomasp85/shinyFiles

  11. jeroen commented on Jan 8, 2025

    @jeroen
    Contributor

    This might hint at a naming conflict with system dll's, see: r-lib/textshaping#36 (comment)

    To work around the problem you can dyn.load() the required Windows system dlls manually before anything else.

  12. gabrjork commented on May 29, 2025

    @gabrjork

    Just to widen the range of the issue to other people who might not be as familiarized with the language: when using R in VSCode the same issue occurs, so as the workaround of calling choose.file() before choose.dir() to prompt selection dialog to open. It reinforces that the issue is with RTerm, as the R Extension for VS Code runs on it as well and, also in my case, RGui.exe shows no issue.

    I was struggling to find reports of my problem because I thought it was a R Extension for VS Code specific, but it doesn't seem to be the case.

  13. saulo1305 commented on May 25, 2026

    @saulo1305

    Any fixes or workarounds on this issue? It`s been 3 years I'm getting this error. The issue was first reported at R 4.3. We are at R 4.6 and still no fix.

  14. torden81 commented on May 26, 2026

    @torden81

    Any fixes or workarounds on this issue? It`s been 3 years I'm getting this error. The issue was first reported at R 4.3. We are at R 4.6 and still no fix.

    Hi,
    as a workaround, using tcltk::tk_choose.dir() works for me.

    Apart from that, you might have more success getting this issue addressed by reporting it to the R project directly, as it seems to be unrelated to RStudio.
    For issues in base packages like {utils}, bug.report(package = "utils") points to: https://bugs.r-project.org/

  15. self-assigned this
    on Jul 15, 2026
  16. added theissue type on Jul 15, 2026
  17. kevinushey commented on Jul 20, 2026

    @kevinushey
    Collaborator

    Should (finally) be resolved, with a fix to be included with the upcoming release in August.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions