Skip to content

Commit e853b56

Browse files
committed
Close #22
1 parent 202b0cd commit e853b56

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# ezcox 1.0.2
22

3+
* Fixed changable `ALL` group in `ezcox_group()`.
34
* Supported interaction term in `controls` option.
45

56

R/ezgrp.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ ezcox_group <- function(data, grp_var, covariate, controls = NULL,
9696
fit_models <- get_models(md_list)
9797

9898
## show_models
99+
if ("ALL" %in% md_list$models$Group) {
100+
# Move this model to bottom
101+
idx_all <- which(md_list$models$Group == "ALL")
102+
idx <- seq_len(length(md_list$models$Group))
103+
if (idx_all != max(idx)) {
104+
new_order <- c(setdiff(idx, idx_all), idx_all)
105+
fit_models <- fit_models[new_order]
106+
}
107+
}
108+
99109
p <- show_models(fit_models, merge_models = TRUE, drop_controls = TRUE, headings = headings, ...)
100110

101111
if (is.null(p)) {

vignettes/ezgroup.Rmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ library(ezcox)
3030

3131
```{r, fig.width=7, fig.height=5}
3232
library(survival)
33+
34+
lung$ph.ecog <- factor(lung$ph.ecog)
35+
3336
ezcox_group(lung, grp_var = "sex", covariate = "ph.ecog")
3437
ezcox_group(lung, grp_var = "sex", covariate = "ph.ecog", controls = "age")
3538
ezcox_group(lung, grp_var = "sex", covariate = "ph.ecog", controls = "age", add_all = TRUE)

0 commit comments

Comments
 (0)