isTruthy | R Documentation |
The terms "truthy" and "falsy" generally indicate whether a value, when
coerced to a base::logical()
, is TRUE
or FALSE
. We use
the term a little loosely here; our usage tries to match the intuitive
notions of "Is this value missing or available?", or "Has the user provided
an answer?", or in the case of action buttons, "Has the button been
clicked?".
isTruthy(x)
x |
An expression whose truthiness value we want to determine |
For example, a textInput
that has not been filled out by the user has
a value of ""
, so that is considered a falsy value.
To be precise, a value is truthy unless it is one of:
FALSE
NULL
""
An empty atomic vector
An atomic vector that contains only missing values
A logical vector that contains all FALSE
or missing values
An object of class "try-error"
A value that represents an unclicked actionButton()
Note in particular that the value 0
is considered truthy, even though
as.logical(0)
is FALSE
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.