Skip to content

Commit

Permalink
Test asreml models in resplot
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerssam committed Jul 10, 2024
1 parent c640e9a commit 9e9736f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
4 changes: 3 additions & 1 deletion R/resplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ resplot <- function(model.obj, shapiro = TRUE, call = FALSE, label.size = 10, ax
facet_name <- NULL
k <- length(model.obj$residual)
}
resids <- residuals(model.obj)
resids <- as.numeric(model.obj[["residuals"]])
fits <- fitted(model.obj)
fits <- ifelse(rep("fitted" %in% names(model.obj), nrow(model.obj$mf)), model.obj[["fitted"]], fitted(model.obj))

if(call) {
model_call <- paste(trimws(deparse(model.obj$call, width.cutoff = 50)), collapse = "\n")
model_call <- gsub("G\\.param \\= model\\.asr\\$G\\.param, ", "", model_call)
Expand Down
Binary file modified tests/testthat/data/asreml_model.Rdata
Binary file not shown.
Binary file modified tests/testthat/data/complex_model.rds
Binary file not shown.
5 changes: 1 addition & 4 deletions tests/testthat/test-resplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test_that("Old mod.obj argument produces a warning", {

test_that("Residual plots work for asreml", {
skip_on_cran()
skip_if_not(requireNamespace("asreml", quietly = TRUE))
# skip_if_not(requireNamespace("asreml", quietly = TRUE))

# dat.asr <- quiet(asreml::asreml(Petal.Length ~ Petal.Width, data = iris, trace = FALSE))
load(test_path("data", "asreml_model.Rdata"), envir = .GlobalEnv)
Expand All @@ -40,9 +40,6 @@ test_that("Residual plots work for asreml", {
vdiffr::expect_doppelganger(title = "Resplot for asreml pt 1", p1_multi[[1]])
vdiffr::expect_doppelganger(title = "Resplot for asreml pt 2", p1_multi[[2]])
vdiffr::expect_doppelganger(title = "Resplot for asreml pt 3", p1_multi[[3]])


# vdiffr::manage_cases()
})


Expand Down

0 comments on commit 9e9736f

Please sign in to comment.