Debian Codegraph @

man/isTruthy.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/utils.R
3 \name{isTruthy}
4 \alias{isTruthy}
5 \title{Truthy and falsy values}
6 \usage{
7 isTruthy(x)
8 }
9 \arguments{
10 \item{x}{An expression whose truthiness value we want to determine}
11 }
12 \description{
13 The terms "truthy" and "falsy" generally indicate whether a value, when
14 coerced to a \code{\link[base:logical]{base::logical()}}, is \code{TRUE} or \code{FALSE}. We use
15 the term a little loosely here; our usage tries to match the intuitive
16 notions of "Is this value missing or available?", or "Has the user provided
17 an answer?", or in the case of action buttons, "Has the button been
18 clicked?".
19 }
20 \details{
21 For example, a \code{textInput} that has not been filled out by the user has
22 a value of \code{""}, so that is considered a falsy value.
23
24 To be precise, a value is truthy \emph{unless} it is one of:
25 \itemize{
26 \item \code{FALSE}
27 \item \code{NULL}
28 \item \code{""}
29 \item An empty atomic vector
30 \item An atomic vector that contains only missing values
31 \item A logical vector that contains all \code{FALSE} or missing values
32 \item An object of class \code{"try-error"}
33 \item A value that represents an unclicked \code{\link[=actionButton]{actionButton()}}
34 }
35
36 Note in particular that the value \code{0} is considered truthy, even though
37 \code{as.logical(0)} is \code{FALSE}.
38 }