yesno: Yes No with Variable Responses

View source: R/yesno.R

yesnoR Documentation

Yes No with Variable Responses

Description

Asks a custom yes-no question with randomly varying responses. Returns a flag indicating whether the user answered yes or no. It is designed to be used in situations where the users needs to confirm an affirmative action.

Usage

yesno(...)

Arguments

...

Objects to paste and then output to produce the question.

Details

The objects are first pasted without separators and collapsed using ⁠[paste0](..., collapse = "")⁠ before being output using cat().

The order and phrasing of the possible responses varies randomly to ensure the user consciously chooses (as opposed to automatically types their response).

A total of three responses are offered - two of which correspond to No and one of which corresponds to Yes. The possible responses are skewed to No to reduce the chances that a blindly-typing user mistakenly chooses an affirmative action. For the same reason, selection of uncertain responses such as 'Uhhh... Maybe?' is considered to be a No. Selection of a 0 (to exit) is also considered to be No. Questions should be phrased accordingly.

Value

A flag indicating whether the user answered yes or no.

See Also

yesno2()

Examples

## Not run: 
yesno("Do you like ", R.Version()$nickname, "?")

## End(Not run)

yesno documentation built on Sept. 11, 2024, 7:23 p.m.