File: ui-questions.Rd

package info (click to toggle)
r-cran-usethis 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,228 kB
  • sloc: sh: 26; makefile: 17; cpp: 6; ansic: 3
file content (74 lines) | stat: -rw-r--r-- 2,541 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ui-legacy.R
\name{ui-questions}
\alias{ui-questions}
\alias{ui_yeah}
\alias{ui_nope}
\title{User interface - Questions}
\usage{
ui_yeah(
  x,
  yes = c("Yes", "Definitely", "For sure", "Yup", "Yeah", "I agree", "Absolutely"),
  no = c("No way", "Not now", "Negative", "No", "Nope", "Absolutely not"),
  n_yes = 1,
  n_no = 2,
  shuffle = TRUE,
  .envir = parent.frame()
)

ui_nope(
  x,
  yes = c("Yes", "Definitely", "For sure", "Yup", "Yeah", "I agree", "Absolutely"),
  no = c("No way", "Not now", "Negative", "No", "Nope", "Absolutely not"),
  n_yes = 1,
  n_no = 2,
  shuffle = TRUE,
  .envir = parent.frame()
)
}
\arguments{
\item{x}{A character vector.

For block styles, conditions, and questions, each element of the
vector becomes a line, and the result is processed by \code{\link[glue:glue]{glue::glue()}}.
For inline styles, each element of the vector becomes an entry in a
comma separated list.}

\item{yes}{A character vector of "yes" strings, which are randomly sampled to
populate the menu.}

\item{no}{A character vector of "no" strings, which are randomly sampled to
populate the menu.}

\item{n_yes}{An integer. The number of "yes" strings to include.}

\item{n_no}{An integer. The number of "no" strings to include.}

\item{shuffle}{A logical. Should the order of the menu options be randomly
shuffled?}

\item{.envir}{Used to ensure that \code{\link[glue:glue]{glue::glue()}} gets the correct
environment. For expert use only.}
}
\value{
A logical. \code{ui_yeah()} returns \code{TRUE} when the user selects a "yes"
option and \code{FALSE} otherwise, i.e. when user selects a "no" option or
refuses to make a selection (cancels). \code{ui_nope()} is the logical opposite
of \code{ui_yeah()}.
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}}

\code{ui_yeah()} and \code{ui_nope()} are technically superseded, but, unlike the rest
of the legacy \code{\link[=ui-legacy-functions]{ui_*()}} functions, there's not yet a
drop-in replacement available in the \href{https://cli.r-lib.org/}{cli package}.
\code{ui_yeah()} and \code{ui_nope()} are no longer used internally in usethis.
}
\examples{
\dontrun{
ui_yeah("Do you like R?")
ui_nope("Have you tried turning it off and on again?", n_yes = 1, n_no = 1)
ui_yeah("Are you sure its plugged in?", yes = "Yes", no = "No", shuffle = FALSE)
}
}
\keyword{internal}