Learn R Programming

S7 (version 0.2.1)

class_any: Dispatch on any class

Description

Use class_any to register a default method that is called when no other methods are matched.

Usage

class_any

Arguments

Examples

Run this code
foo <- new_generic("foo", "x")
method(foo, class_numeric) <- function(x) "number"
method(foo, class_any) <- function(x) "fallback"

foo(1)
foo("x")

Run the code above in your browser using DataLab