diff --git a/R/registry.R b/R/registry.R index c1451244..d80a2386 100644 --- a/R/registry.R +++ b/R/registry.R @@ -105,7 +105,7 @@ get_s3_method <- function(generic, obj) { } } - stop("no method found for generic ", generic, "and classes ", + stop("no method found for generic ", generic, " and classes ", paste0(class(obj), collapse = ", ")) } diff --git a/vignettes/registry.Rmd b/vignettes/registry.Rmd index 7354b036..80d5f1e9 100644 --- a/vignettes/registry.Rmd +++ b/vignettes/registry.Rmd @@ -183,9 +183,10 @@ new_tail_block <- function(data, n_rows = numeric(), ...) { } ``` -In addition to that, you also might have to specify what kind of __input__ and __output__ are accepted by that block. We designed 2 helpers, namely `block_input_check()` and `block_output_ptype()`. `{blockr}` already exposes methods for `data_block` and `transform_block` so you don't need to create a new method for those classes. However, we see a practical example on how to create such methods for plots in this [vignette](https://bristolmyerssquibb.github.io/blockr/articles/plot-block.html). Below is what these methods look like: +In addition to that, you also might have to specify what kind of __input__ and __output__ are accepted by that block. We designed 2 helpers, namely `block_input_check()` and `block_output_ptype()`. `{blockr}` already exposes methods for `data_block` and `transform_block` so you don't need to create a new method for those classes. However, we see a practical example on how to create such methods for plots in this [vignette](https://bristolmyerssquibb.github.io/blockr/articles/plot-block.html). Below is what these methods look like, don't forget to export them if you are running inside a R package: ```r +#' @export block_input_check.transform_block <- function(x, data, ...) { if (inherits(data, "data.frame")) { @@ -194,6 +195,7 @@ block_input_check.transform_block <- function(x, data, ...) { input_failure("Expecting data.frame input.") } +#' @export block_output_ptype.transform_block <- function(x, ...) data.frame() ```