[R-pkg-devel] Private S3 Method not Found

biii m@iii@g oii de@@ey@ws biii m@iii@g oii de@@ey@ws
Mon Feb 17 16:05:33 CET 2020


Hello,

 

I'm working on a function in a package that will provide an exported
function that will convert formula to LaTeX equations.  For that, it
recursively goes through the formula converting objects of class "formula",
"call", "name", and "(" to LaTeX.

 

I have a private S3 generic function that I'm using for the conversion, but
for some reason, the generic is not detected, and checking the package fails
for that reason
(https://travis-ci.org/billdenney/bsd.report/jobs/651510333):

 

no applicable method for 'knit_print_helper_formula' applied to an object of
class "name"

Backtrace:

  1. testthat::expect_equal(...)

  4. bsd.report:::knit_print.formula(a ~ b(c))

  6. bsd.report:::knit_print_helper_formula.formula(x, ..., replacements =
replacements)

  9. bsd.report:::knit_print_helper_formula.call(x[[3]], ...)

10. bsd.report:::knit_print_helper_formula.function_call(x, ...)

11. base::sapply(...)

12. base::lapply(X = X, FUN = FUN, ...)

13. bsd.report:::FUN(X[[i]], ...)

 

But, there is a knit_print_helper_formula.name function call defined
(https://github.com/billdenney/bsd.report/blob/master/R/knit_print.formula.R
#L60-L79):

 

knit_print_helper_formula <- function(x, ...) {

  UseMethod("knit_print_helper_formula")

}

 

# Some other methods

 

knit_print_helper_formula.name <- function(x, ...) {

# Function body

}

 

Does anyone know why the S3 method for name class objects is not found when
checking the package?

 

Thanks,

 

Bill


	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list