Wait for a single keypress at the terminal

Share:

Description

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

Usage

1

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’.

Value

The key pressed, a character scalar.

See Also

Other keypress: has_keypress_support

Examples

1
2
3
4
5
## Not run: 
x <- keypress()
cat("You pressed key", x, "\n")

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.