waiver | R Documentation |
A flag indicating that the default value of an argument should be used.
waiver()
A waiver()
is a flag passed to a function argument that indicates the
function should use the default value of that argument. It is used in two
cases:
ggplot2 functions use it to distinguish between "nothing" (NULL
)
and a default value calculated elsewhere (waiver()
).
ggdist turns ggplot2's convention into a standardized method of
argument-passing: any named argument with a default value in an
automatically partially-applied function can be passed
waiver()
when calling the function. This will cause the default value
(or the most recently partially-applied value) of that argument to be used
instead.
Note: due to historical limitations, waiver()
cannot currently be
used on arguments to the point_interval()
family of functions.
auto_partial()
, ggplot2::waiver()
f = auto_partial(function(x, y = "b") {
c(x = x, y = y)
})
f("a")
# uses the default value of `y` ("b")
f("a", y = waiver())
# partially apply `f`
g = f(y = "c")
g
# uses the last partially-applied value of `y` ("c")
g("a", y = waiver())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.