Skip to content

Commit

Permalink
1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jinseob2kim committed May 29, 2023
1 parent d8f4faf commit 84263de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: jstable
Title: Create Tables from Different Types of Regression
Version: 1.1.0
Date: 2023-05-04
Version: 1.1.1
Date: 2023-05-29
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.1

* Bugfix `LabelepiDisplay`: thanks for `thisis05`

# jstable 1.1.0

* Bugfix `TableSubgroupCox`: thanks for `Ding-yuan Wan`
Expand Down
22 changes: 11 additions & 11 deletions R/label.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ mk.lev = function(data){
#' @importFrom data.table data.table :=


LabelepiDisplay = function(epiDisplay.obj, label = F, ref){
LabelepiDisplay <- function(epiDisplay.obj, label = F, ref){

lv2 <- variable <- level <- val_label <- NULL

Expand All @@ -84,12 +84,12 @@ LabelepiDisplay = function(epiDisplay.obj, label = F, ref){


## Var label
tb.rn = gsub(" \\(cont. var.\\)", "", rownames(tb.compact))
tb.rn <- gsub(" \\(cont. var.\\)", "", rownames(tb.compact))
rownames(tb.compact) <- tb.rn

if (nrow(tb.main) < 2 & label == T){
vname <- strsplit(rownames(tb.compact)[1], ":")[[1]][1]
cond.lv2 <- grepl(":", rownames(tb.compact)[1]) & grepl("vs", rownames(tb.compact)[1])
vname <- strsplit(rownames(tb.compact)[1], ": ")[[1]][1]
cond.lv2 <- grepl(": ", rownames(tb.compact)[1]) & grepl(" vs ", rownames(tb.compact)[1])
rownames(tb.compact) <- gsub(vname, ref[variable == vname, var_label][1], rownames(tb.compact))
if (cond.lv2){
lv2 <- strsplit(strsplit(rownames(tb.compact)[1], ": ")[[1]][[2]], " vs ")[[1]]
Expand All @@ -103,8 +103,8 @@ LabelepiDisplay = function(epiDisplay.obj, label = F, ref){
vns <- c(vn, length(tb.rn)+1 )
vl <- lapply(1:length(vn), function(x){tb.rn[vns[x]:(vns[x+1]-1)]})
vl_label <- lapply(vl, function(x){
vname <- strsplit(x[1], ":")[[1]][1]
cond.lv2 <- grepl(":", x[1]) & grepl("vs", x[1])
vname <- strsplit(x[1], ": ")[[1]][1]
cond.lv2 <- grepl(": ", x[1]) & grepl(" vs ", x[1])
#x[1] <- gsub(vname, ref[variable == vname, var_label][1], x[1])
if (cond.lv2){
lv2 <- strsplit(strsplit(x[1], ": ")[[1]][[2]], " vs ")[[1]]
Expand Down Expand Up @@ -165,7 +165,7 @@ LabelepiDisplay = function(epiDisplay.obj, label = F, ref){
#' @export
#' @importFrom data.table data.table :=

LabeljsTable = function(obj.table, ref){
LabeljsTable <- function(obj.table, ref){

lv2 <- variable <- level <- val_label <- NULL

Expand All @@ -177,8 +177,8 @@ LabeljsTable = function(obj.table, ref){

if (nrow(tb.main) == 1){

vname <- strsplit(rownames(tb.compact)[1], ":")[[1]][1]
cond.lv2 <- grepl(":", rownames(tb.compact)[1]) & grepl("vs", rownames(tb.compact)[1])
vname <- strsplit(rownames(tb.compact)[1], ": ")[[1]][1]
cond.lv2 <- grepl(":", rownames(tb.compact)[1]) & grepl(" vs ", rownames(tb.compact)[1])
rownames(tb.compact) <- gsub(vname, ref[variable == vname, var_label][1], rownames(tb.compact))
if (cond.lv2){
lv2 <- strsplit(strsplit(rownames(tb.compact)[1], ": ")[[1]][[2]], " vs ")[[1]]
Expand All @@ -193,9 +193,9 @@ LabeljsTable = function(obj.table, ref){
vns <- c(vn, length(tb.rn)+1 )
vl <- lapply(1:length(vn), function(x){tb.rn[vns[x]:(vns[x+1]-1)]})
vl_label = lapply(vl, function(x){
vname <- strsplit(x[1], ":")[[1]][1]
vname <- strsplit(x[1], ": ")[[1]][1]
x[1] <- gsub(vname, ref[variable == vname, var_label][1], x[1])
cond.lv2 <- grepl(":", x[1]) & grepl("vs", x[1])
cond.lv2 <- grepl(": ", x[1]) & grepl(" vs ", x[1])
#x[1] <- gsub(vname, ref[variable == vname, var_label][1], x[1])
if (cond.lv2){
lv2 <- strsplit(strsplit(x[1], ": ")[[1]][[2]], " vs ")[[1]]
Expand Down

0 comments on commit 84263de

Please sign in to comment.