[R] interactive prompts

Ernie Adorio adorio at math.upd.edu.ph
Tue Oct 21 08:47:03 CEST 2003


Am using R on a Linux box and am currently writing an interactive R script.

1. How do I ask a user to press any key to continue ? I used a system call to 
read but this only works if the Enter key is pressed:
  print("Press any key to continue")
  system("read")

2. How do I get a string input from the user? Would like to see an R function,
say askget():

  delay  =  askget("Enter delay in seconds")
  system(paste( "sleep ", delay))

TIA,

Ernie Adorio
Math Department
University of the Philippines
Diliman, Quezon City




More information about the R-help mailing list