keypress (version 1.0.0)

keypress: Wait for a single keypress at the terminal

Description

It currently only works at Linux/Unix and OSX terminals, see has_keypress_support.

Usage

keypress()

Arguments

Value

The key pressed, a character scalar.

Details

The following special keys are supported:
  • Arrow keys: ‘up’, ‘down’, ‘right’, ‘left’.
  • Function keys: from ‘f1’ to ‘f12’.
  • Others: sQuotehome, ‘end’, ‘insert’, ‘delete’, ‘pageup’, ‘pagedown’.

See Also

Other keypress: has_keypress_support

Examples

Run this code
## Not run: 
# x <- keypress()
# cat("You pressed key", x, "\n")
# ## End(Not run)

Run the code above in your browser using DataLab