Looking to time how long it takes a user to type a message in R from the first keystroke.
I can use functions like readline() or scan() to get the user input, and I can use the system.time() to measure how long it takes for the code to be run:
> system.time(readline())
Test Message
user system elapsed
0.98 0.53 19.55
However, these give me the total elapsed time. If I wait wait 15 seconds before typing, this is reflected in the output of system.time(), and not just the time I spent to write the message. (E.g 19.55s = 15s + ~4.5s I used to type the message.)
Looking for this to happen in the console, but also willing to use a separate window if necessary.