0

I want to write a R script, where I give an input at some point. I want to run it in Rstudio. I do:

print("hi")
readline("Press a key to continue")
print("ho")

But the script does not stop and readline returns "".

I figured it is probably because my session is not "interactive". Is there a readline which will work for non-interactive processing? Or can I make my script interactive?

EDIT:

How to wait for a keypress in R? is not a duplicate, I even use the method "readline" stated in the accepted answer in my minimal failing example.

PascalIv
  • 595
  • 7
  • 21
  • [This answer](https://stackoverflow.com/a/22933024/8366499) discusses using `scan` in non-interactive mode. If that doesn't solve your question, you should give us more details on what you're trying to do. – divibisan Sep 12 '18 at 15:03
  • The help for `readline` says: *In non-interactive use the result is as if the response was RETURN and the value is "".* This is exactly what you observe in your example... – R Yoda Dec 21 '18 at 18:23

0 Answers0