Learn R Programming

aisdk (version 1.1.0)

console_input: Console Text Input

Description

Prompt the user for free-text input with optional default value.

Usage

console_input(prompt, default = NULL)

Value

The user's input string, default if empty input and default is set, or NULL if empty input with no default.

Arguments

prompt

The prompt message to display.

default

Optional default value shown in brackets. Returned if user presses Enter without typing.

Examples

Run this code
# \donttest{
if (interactive()) {
  name <- console_input("Project name", default = "my-project")
  api_key <- console_input("API key")
}
# }

Run the code above in your browser using DataLab