keypress

Read a single key press from the terminal

Installation

install.packages("keypress")

Usage

> has_keypress_support()
[1] TRUE
> x <- keypress()
> cat("You pressed key", x, "\n")
You pressed key h

Support

This is unfortunately impossible to do in

In other words, it pretty much only works interactively, in a terminal. The terminal can be any Linux, macOS, or other Unix terminal or Windows cmd (also called RTerm in R) or Windows terminal.

Features

Keys

Note that not all keys are supported, in particular most of the modifiers (alt, shift, etc.) are not. Supported special keys are:

License

MIT © Gábor Csárdi