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

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:"))

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.6k users

Browse Categories