class_missing: Dispatch on a missing argument

class_missingR Documentation

Dispatch on a missing argument

Description

Use class_missing to dispatch when the user has not supplied an argument, i.e. it's missing in the sense of missing(), not in the sense of is.na().

Usage

class_missing

Value

Sentinel objects used for special types of dispatch.

Examples

foo <- new_generic("foo", "x")
method(foo, class_numeric) <- function(x) "number"
method(foo, class_missing) <- function(x) "missing"
method(foo, class_any) <- function(x) "fallback"

foo(1)
foo()
foo("")

S7 documentation built on April 3, 2025, 10:50 p.m.