When I use devtools::check() on my package, it produces an error suggesting my example doesn't work. When just running the function normally outside of the package it works just fine, so I'm wondering what the issue could be?
It produces error:
Error in UseMethod("decision_lm") : no applicable method for 'decision_lm' applied to an object of class "function" Calls: decision_lm Execution halted This is my roxygen skeleton
#' Decision of linear regression test #' #' @description Gives the decision of retention or rejection for a linear #' regression test #' #' @param fit1_lm list #' @param ... other arguments #' #' @return characters #' #' @examples #' fit1_lm <- fit_lm <- function(dat1) { #' model <- lm(dat1$weight ~ dat1$height) #' f1 <- summary(model)$coefficients[2,1] #' f2 <- confint(model)[2,1] #' f3 <- confint(model)[2,2] #' f4 <- summary(model)$coefficients[2,3] #' f5 <- df.residual(model) #' f6 <- summary(model)$coefficients[2,4] #' structure( #' list(beta_hat = f1, CI_Lower = f2, CI_Upper = f3, t.value = f4, df = f5, p.value = f6), #' class = "mytest") # Returns object of class mytest #' } #' fit1_lm(project2022) #' decision_lm(fit1_lm) #' @export decision_lm <- function(fit1_lm, ...) { UseMethod("decision_lm") } #' @method decision_lm mytest #' @export decision_lm.mytest <- function(fit1_lm, ...) { if (fit1_lm[6] <= 0.05) { glue::glue("We reject the null hypothesis, as the p-value <= 0.05") } else if (fit1_lm[6] > 0.05) { glue::glue("We do not reject the null hypothesis, as the p-value > 0.05") } }