texreg extract method in own package: error, setMethod()! no existing definition for function ‘extract’

Hi,

I am developing a package called EDCS. I want to include an extract method for texreg to print tables of estimated models, where the models are of class EDCSfitted. Unfortunately, I keep getting an error: setMethod()! no existing definition for function ‘extract’

According to the texreg vignette, you simply create a custom function and register this function as a method for texreg's generic extract() function. In my case:

#' @export
extract.EDCSfitted <- function(model, ...) { # My custom function
   ....
  return(tr) # Return a texreg object
}

#' @export
methods::setMethod(
  "extract",
  signature = methods::className("EDCSfitted", "EDCS"),
  definition = extract.EDCSfitted)

Unfortunately, trying to build the package results in the error:

Error in `load_all()`:
! Failed to load 'R/generics.R'
Caused by error in `methods::setMethod()`:
! no existing definition for function ‘extract’

Herewith an extract from my DESCRIPTION file:

Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Depends:
    methods,
    zoo,
    sandwich
LinkingTo: 
    Rcpp,
    RcppEigen,
    StanHeaders,
    RcppParallel
Imports: 
    Rcpp,
    texreg
Suggests:
    WeightedPortTest,
    vrtest
SystemRequirements:
    C++14,
    GNU make

I have compared my code to some other packages' code on GitHub and I can't really pinpoint the issue. I also tried several different variations where I don't use fully qualified and added #' @importFrom texreg extract before #' @export. Nothing seems to work.

Unfortunately, I cannot make my package public at this stage.

I'd really appreciate some help or suggestions.

This topic was automatically closed after 45 days. New replies are no longer allowed.


If you have a query related to it or one of the replies, start a new topic and refer back with a link.