2

I have an executable R file. All of the code works as expected, except for the function winDialog(), which works through RStudio, but not when the file is run through double clicking.

The code in question is as follows:

winDialog("ok", paste0("The checks have been completed in ", round(as.numeric(time.taken), digits = 2), " minutes."))

time.taken exists as a variable, so that is not the problem.

Is there a different function that would work?

Edit: My question is similar to this one: gWidgets GUI cannot display when called with R CMD BATCH Also similar to this one: https://thesquareplanet.com/blog/interactive-r-scripts/ Still not sure how to implement.

The difference is, I would like to know how I can set the Rexec file to automatically run interactively, instead of running it from the command line with an extra argument every time?

lovalery
  • 4,524
  • 3
  • 14
  • 28
  • 1
    What is the error you get? – vishwarajanand Jul 24 '17 at 07:35
  • Is there a reason you can't just use `cat()` and have your message in the terminal? – Michael Bird Jul 24 '17 at 08:36
  • @KhatamNaayak There is no error, just no dialog box popping up. – user5720052 Jul 24 '17 at 23:39
  • @Michael I'm avoiding anything in the terminal, as I need a nice GUI which doesn't require looking at any code to know when it has finished running. – user5720052 Jul 24 '17 at 23:39
  • To verify that problem is with winDialog(), can you check executing a simple winDialog("ok", "some message") or winDialogString("Some message", "Default Message") and share output? – vishwarajanand Jul 25 '17 at 06:22
  • @KhatamNaayak I've done this, and I just realised that there is an error, but as soon as the error is shown the window closes itself. I'm looking at this problem but I cannot find a solution. *Edit: I have run it and tried to catch the error in a screenshot, and I am getting "winDialog() cannot be used non-interactively Exec" – user5720052 Jul 25 '17 at 07:53
  • May I know which version of R you are using? – vishwarajanand Jul 25 '17 at 08:51
  • @KhatamNaayak R 3.4.0, and the executable file is using RScript.exe – user5720052 Jul 25 '17 at 11:12
  • @KhatamNaayak It appears my question is similar to this one:https://stackoverflow.com/questions/18730175/gwidgets-gui-cannot-display-when-called-with-r-cmd-batch. How would I implement this without using the command line every time, just by changing one setting and double-clicking the file? – user5720052 Jul 25 '17 at 11:50

0 Answers0