I am using R to generate a series of plots within a loop, with the user hitting the enter key to indicate they have seen the plot and it is time to move on. These are interactive rotatable plots generated with the rgl package and therefore using something like Sys.sleep() is not good enough.
Currently I can use readline() which works find when running R interactively. However, if I want to run my R script within a bash script all the plots appear flashing before the screen. This happens whether I call R using:
R --no-save -f myfile.r
R --no-save -e "source('myfile.r')"
R --no-save << myfile.r
How do I get R to pause and wait for the user to hit when run as a bash subprocess?