Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

694 fix stats ancova old versions@main #695

Merged
merged 2 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
* Renamed `test-assertthat.R` to `test-utils_checkmate.R`.

### Bug Fixes
* Fixed bugs from tests that rely on `stats::ancova`. They are probably due to an external update.
* Fixed bugs from tests that rely on `stats::ancova`. Adding more general solutions. They
are probably due to an external update.
* Fixed tests to respect the new standard print for `NA`.
* Fixed error in tests coming from changes in `formatters::var_labels()`.
* Identified bug in `prop_diff` functions. Coding of responses have been corrected (TRUE is a success).
Expand Down
2 changes: 1 addition & 1 deletion R/coxph.R
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ s_cox_univariate <- function(formula,
lrt <- Map(
f = function(without_interaction,
with_interaction) {
stats::anova(without_interaction$mod, with_interaction$mod)[2, "Pr(>|Chi|)"]
stats::anova(without_interaction$mod, with_interaction$mod)[2, 4] # Pr(>|Chi|)
},
without_interaction = fit[2:(length(covariates) + 1)],
with_interaction = fit[-(1:(length(covariates) + 1))] # nolint
Expand Down
6 changes: 5 additions & 1 deletion tests/testthat/test-summarize_ancova.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ testthat::test_that("h_ancova works with healthy input", {
) %>%
as.data.frame()

# Fixing class differences between versions
exp_class <- "data.frame"
if (inherits(result, "summary_emm")) exp_class <- c("summary_emm", exp_class)

expected <- structure(
data.frame(
Species = as.factor(c("setosa", "versicolor", "virginica")),
Expand All @@ -17,7 +21,7 @@ testthat::test_that("h_ancova works with healthy input", {
lower.CL = c(5.488497, 5.585349, 5.112255),
upper.CL = c(6.821149, 5.849469, 5.700498)
),
class = c("summary_emm", "data.frame"),
class = exp_class,
estName = "emmean",
clNames = c("lower.CL", "upper.CL"),
pri.vars = "Species",
Expand Down