s3_dispatch() prints a list of all possible function names that will be considered for method dispatch. There are four possible states:

  • => method exists and is found by UseMethod().

  • -> method exists and is used by NextMethod().

  • * method exists but is not used.

  • Nothing (and greyed out in console): method does not exist.

Learn more at https://adv-r.hadley.nz/s3.html.

s3_dispatch(call, env = parent.frame())

Arguments

call

Example call to S3 method

env

Environment in which to evaluate call

Examples

x <- Sys.time() s3_dispatch(print(x))
#> => print.POSIXct #> print.POSIXt #> * print.default
s3_dispatch(is.numeric(x))
#> is.numeric.POSIXct #> => is.numeric.POSIXt #> is.numeric.default #> * is.numeric (internal)
s3_dispatch(as.Date(x))
#> => as.Date.POSIXct #> as.Date.POSIXt #> * as.Date.default
s3_dispatch(sum(x))
#> sum.POSIXct #> sum.POSIXt #> sum.default #> => Summary.POSIXct #> Summary.POSIXt #> Summary.default #> -> sum (internal)
# Internal vs. regular generic x1 <- 1 x2 <- structure(2, class = "double") my_length <- function(x) UseMethod("my_length") s3_dispatch(my_length(x1))
#> my_length.double #> my_length.numeric #> my_length.default
s3_dispatch(my_length(x2))
#> my_length.double #> my_length.default
length.double <- function(x) 10 s3_dispatch(length(x1))
#> * length.double #> length.numeric #> length.default #> => length (internal)
s3_dispatch(length(x2))
#> => length.double #> length.default #> * length (internal)