The following code runs nicely in the console or from an .r-file:
library(rstudioapi)
thisisthepathvariable <- rstudioapi::selectDirectory(caption = "Select path")
A dialog box opens, where I can select a path, this path is saved to the variable thisisthepathvariable in string format, as it should.
However, I would like to implement the same functionality in an RMarkdown document, but when I press the green play button on top right...
...the green play button turns into a clock, and when I click the clock icon, I get:
If I click OK, the dialog disappears, but the clock is still there and if I click don't run the running stops and the clock turns back into that green play button.
So why isn't this working? Is there a way to use rstudioapi dialogs from RMarkdown documents? Am I doing something wrong?