Skip to content

Commit

Permalink
Fix: ref. for interaction terms in glmshow - ksh
Browse files Browse the repository at this point in the history
  • Loading branch information
Suhyeon-Kwon committed Mar 22, 2024
1 parent 61dec48 commit 1935c42
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: jstable
Title: Create Tables from Different Types of Regression
Version: 1.1.8
Version: 1.1.9
Date: 2024-03-22
Authors@R: c(person("Jinseob", "Kim", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9403-605X")),
person("Zarathu", role = c("cph", "fnd")),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# jstable 1.1.9

* Fix: ref. for interaction terms in `glmshow`.

# jstable 1.1.8

* Add `normalityTest` option to `CreateTableOneJS` to perform the Shapiro test for all variables.
Expand Down
13 changes: 12 additions & 1 deletion R/glmshow.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,18 @@ glmshow.display <- function(glm.object, decimal = 2) {
rn.list[[x]] <<- paste(xs[x], ": ", model$xlevels[[xs[x]]][2], " vs ", model$xlevels[[xs[x]]][1], sep = "")
})
lapply(varnum.mfac, function(x) {
rn.list[[x]] <<- c(paste(xs[x], ": ref.=", model$xlevels[[xs[x]]][1], sep = ""), gsub(xs[x], " ", rn.list[[x]]))
if (grepl(":", xs[x])){
a <- unlist(strsplit(xs[x], ":"))[1]
b <- unlist(strsplit(xs[x], ":"))[2]
if (a %in% xs && b %in% xs ){
ref <- paste0(a, model$xlevels[[a]][1], ":", b, model$xlevels[[b]][1])
rn.list[[x]] <<- c(paste(xs[x], ": ref.=", ref, sep = ""), gsub(xs[x], " ", rn.list[[x]]))
} else{
rn.list[[x]] <<- c(paste(xs[x], ": ref.=NA", model$xlevels[[xs[x]]][1], sep = ""), gsub(xs[x], " ", rn.list[[x]]))
}
} else{
rn.list[[x]] <<- c(paste(xs[x], ": ref.=", model$xlevels[[xs[x]]][1], sep = ""), gsub(xs[x], " ", rn.list[[x]]))
}
})
if (class(fix.all.unlist)[1] == "character") {
fix.all.unlist <- t(data.frame(fix.all.unlist))
Expand Down

0 comments on commit 1935c42

Please sign in to comment.