It currently only works at Linux/Unix and OSX terminals,
and at the Windows command line. see has_keypress_support.
Arguments
- block
Whether to wait for a key press, if there is none available now.
- timeout
Maximum number of seconds to wait for a key press, if
blockisTRUE. The defaultInfwaits indefinitely. If no key is pressed before the timeout expires,NAis returned. Ignored for non-blocking reads (block = FALSE). The wait is interruptible regardless of the timeout.
Value
The key pressed, a character scalar. NA is returned if no
key is available: for non-blocking reads, or when a blocking read
times out.
Details
The following special keys are supported:
Arrow keys: 'up', 'down', 'right', 'left'.
Function keys: from 'f1' to 'f12'.
Others: 'home', 'end', 'insert', 'delete', 'pageup', 'pagedown', 'tab', 'enter', 'backspace' (same as 'delete' on OSX keyboards), 'escape'.
Control with one of the following keys: 'a', 'b', 'c', 'd', 'e', 'f', 'h', 'k', 'l', 'n', 'p', 't', 'u', 'w'.
See also
Other keypress function:
has_keypress_support()