Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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
edited 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

...