About TableSubgroupMultiGLM
First of all, I would like to thank the author for writing this function, but I have noticed that there seem to be some errors. I hope the author can provide an answer.
When using the #TableSubgroupMultiGLM function with family="Gaussian" and date = data.design, an error will occur if the subgroup variable is a categorical variable with more than three levels.
For example,
library(survey) lung %>% mutate( status = as.integer(status == 1), sex = factor(sex), kk = factor(ifelse(pat.karno < 70,1, ifelse(pat.karno >= 70 & pat.karno <= 90,2,3))) ) -> lung data.design <- svydesign(id = ~1, data = lung) TableSubgroupMultiGLM(status ~ sex, var_subgroups = c("kk"), data = data.design, family = "gaussian" )
<error/purrr_error_indexed>
Error in purrr::map():
ℹ In index: 1.
Caused by error in .svycheck():
! ..2 used in an incorrect context, no ... to look in
Backtrace: ▆
- ├─jstable::TableSubgroupMultiGLM(...)
- │ └─purrr::map(...)
- │ └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
- │ ├─purrr:::with_indexed_errors(...)
- │ │ └─base::withCallingHandlers(...)
- │ ├─purrr:::call_with_cleanup(...)
- │ └─jstable (local) .f(.x[[i]], ...)
- │ └─jstable::TableSubgroupGLM(...)
- │ ├─stats::anova(model.int, method = "Wald")
- │ └─survey:::anova.svyglm(model.int, method = "Wald")
- │ └─survey:::oneanova.svyglm(object, test, method)
- │ ├─base::eval(bquote(update(thismodel, . ~ . - (.(thisformula)))))
- │ │ └─base::eval(bquote(update(thismodel, . ~ . - (.(thisformula)))))
- │ ├─stats::update(thismodel, . ~ . - (sex:kk))
- │ ├─stats::update(thismodel, . ~ . - (sex:kk))
- │ ├─stats::update.default(thismodel, . ~ . - (sex:kk))
- │ │ └─base::eval(call, parent.frame())
- │ │ └─base::eval(call, parent.frame())
- │ └─survey::svyglm(formula = status ~ sex + kk, design = ..2, family = ..3)
- │ └─survey:::.svycheck(design)
- └─base::.handleSimpleError(...)
- └─purrr (local) h(simpleError(msg, call))
-
└─cli::cli_abort(...) -
└─rlang::abort(...)
Hello. I'm sorry and I fix it
Please install the latest version via
remotes::install_github("jinseob2kim/jstable")