Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in R Programming by (5.3k points)

I want to pause my R script until the user presses a key.

How do I do this?

1 Answer

0 votes
by

You can the following code to prompt a user to press Enter to continue:

readline(prompt="Press [enter] to continue:")

If you don’t want the prompt to print on the console after the Enter key is pressed, wrap the above function in the invisible() function.i.e.,

invisible(readline(prompt="Press [enter] to continue:"))

Browse Categories

...