| Title: | Ask Yes-No Questions |
|---|---|
| Description: | Asks Yes-No questions with variable or custom responses. |
| Authors: | Ayla Pearson [cre] (ORCID: <https://orcid.org/0000-0001-7388-1222>), Joe Thorley [aut, cph] (ORCID: <https://orcid.org/0000-0002-7683-4592>), Hadley Wickham [aut, cph] (ORCID: <https://orcid.org/0000-0003-4757-117X>) |
| Maintainer: | Ayla Pearson <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.3.9000 |
| Built: | 2026-05-23 19:16:36 UTC |
| Source: | https://github.com/poissonconsulting/yesno |
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.
yesno(...)yesno(...)
... |
Objects to paste and then output to produce the question. |
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.
A flag indicating whether the user answered yes or no.
## Not run: yesno("Do you like ", R.Version()$nickname, "?") ## End(Not run)## Not run: yesno("Do you like ", R.Version()$nickname, "?") ## End(Not run)
Asks a custom yes-no question with two responses (by default 'Yes' or 'No'). Returns a flag indicating which response the user choose. It is designed to be used in situations where a user needs to choose one of two affirmative options.
yesno2(..., yes = "Yes", no = "No")yesno2(..., yes = "Yes", no = "No")
... |
Objects to paste and then output to produce the question. |
yes |
A string of the first response. |
no |
A string of the second response. |
The objects are first pasted without separators
and collapsed using [paste0](..., collapse = "")
before being output using cat().
Selection of a 0 (to exit) causes the code to throw an error.
A flag indicating whether the user selected the first (TRUE) or second (FALSE) response.
## Not run: yesno2("Do you like this question?", yes = "I really do") ## End(Not run)## Not run: yesno2("Do you like this question?", yes = "I really do") ## End(Not run)