jinseob2kim / jstable

Regression Tables from 'GLM', 'GEE', 'GLMM', 'Cox' and 'survey' Results.
https://jinseob2kim.github.io/jstable/
Apache License 2.0
23 stars 13 forks source link

jstable can't include subgroups(more than 3 levels) #31

Closed XenonYang closed 4 months ago

XenonYang commented 5 months ago

[(https://cloud.tencent.com/developer/article/2319693)]

`rm(list = ls()) library(survival)

str(colon) suppressMessages(library(tidyverse))

df <- colon %>% mutate(rx=as.numeric(rx)) %>% filter(etype == 1, !rx == 2) %>% #rx %in% c("Obs","Lev+5FU"), select(time, status,rx, sex, age,obstruct,perfor,adhere,differ,extent,surg,node4) %>% mutate(sex=factor(sex, levels=c(0,1),labels=c("female","male")), age=ifelse(age >65,">65","<=65"), age=factor(age, levels=c(">65","<=65")), obstruct=factor(obstruct, levels=c(0,1),labels=c("No","Yes")), perfor=factor(perfor, levels=c(0,1),labels=c("No","Yes")), adhere=factor(adhere, levels=c(0,1),labels=c("No","Yes")), differ=factor(differ, levels=c(1,2,3),labels=c("well","moderate","poor")), extent=factor(extent, levels=c(1,2,3,4), labels=c("submucosa","muscle","serosa","contiguous")), surg=factor(surg, levels=c(0,1),labels=c("short","long")), node4=factor(node4, levels=c(0,1),labels=c("No","Yes")), rx=ifelse(rx==3,0,1), rx=factor(rx,levels=c(0,1)) )

str(df)

library(jstable)

res <- TableSubgroupMultiCox( formula = Surv(time, status) ~ rx, var_subgroups = c("sex","age","obstruct","perfor","adhere", "differ","extent","surg","node4"), data = df ) res ` The first line links to a person using the "jstable" for subgroup analysis, and its original code is under the link. What I want to know is if I want to do a subgroup analysis, how to analyze the subgroup containing more than 2 categories. The above code runs in full. Sorry for the interruption.

Ink-Mo commented 5 months ago

I have the same problem:

res <- TableSubgroupMultiCox(formula = Surv(time, Status) ~ group,

mfsd2a commented 5 months ago

I encountered the similar issue, solved it by downgrading the version of jstable to 1.1.9. Hope this information can help you.

Ink-Mo commented 5 months ago

I encountered the similar issue, solved it by downgrading the version of jstable to 1.1.9. Hope this information can help you.

Downgrading to 1.1.9 still doesn't fix it

jinseob2kim commented 5 months ago

I fix the issue. please install the latest version via remotes::install_github("jinseob2kim/jstable")

XenonYang commented 5 months ago

I fix the issue. please install the latest version via remotes::install_github("jinseob2kim/jstable")

I just downloaded the latest version and this problem has been solved, thank you very much!

Ink-Mo commented 5 months ago

I fix the issue. please install the latest version via remotes::install_github("jinseob2kim/jstable")

Yeah! It has been fixed. Thank you vary much!

Cextra commented 4 months ago

Hi, I tried updating the latest version, remotes::install_github(‘jinseob2kim/jstable’), but it still prompts Error in purrr::map(., ~survival::survfit(formula.km, data = .)) : ℹ In index: 3. ℹ With name: st. Caused by error in survfit.formula():

I fix the issue. please install the latest version via remotes::install_github("jinseob2kim/jstable")我解决了这个问题。请通过以下方式 remotes::install_github("jinseob2kim/jstable") 安装最新版本

jinseob2kim commented 4 months ago

Hi, I tried updating the latest version, remotes::install_github(‘jinseob2kim/jstable’), but it still prompts Error in purrr::map(., ~survival::survfit(formula.km, data = .)) : ℹ In index: 3. ℹ With name: st. Caused by error in survfit.formula():

I fix the issue. please install the latest version via remotes::install_github("jinseob2kim/jstable")我解决了这个问题。请通过以下方式 remotes::install_github("jinseob2kim/jstable") 安装最新版本

Could you share the example data and code?

Cextra commented 4 months ago

Hi, I tried updating the latest version, remotes::install_github(‘jinseob2kim/jstable’), but it still prompts Error in purrr::map(., ~survival::survfit(formula.km, data = .)) : ℹ In index: 3. ℹ With name: st. Caused by error in survfit.formula():

I fix the issue. please install the latest version via remotes::install_github("jinseob2kim/jstable")我解决了这个问题。请通过以下方式 remotes::install_github("jinseob2kim/jstable") 安装最新版本

Could you share the example data and code?

Sure df <- aa %>% select(time,status,group,age,BMI,hypertension,diabetes,ACS) %>% mutate(status = as.integer(status == 1), age = ifelse(age <65,"<65",">=65"), age = factor(age, levels = c("<65",">=65")), BMI = ifelse(BMI <28,"<28", ">= 28"), BMI = factor(BMI, levels = c("<28", ">= 28")), hypertension = factor(hypertension, levels = c(0, 1), labels = c("No", "Yes")), diabetes = factor(diabetes, levels = c(0, 1), labels = c("No", "Yes")), ACS=factor(ACS, levels=c(1,2,3,4),labels=c("non","ua","st","nst")))
res <- TableSubgroupMultiCox(formula = Surv(time, status) ~ group, var_subgroups = c("age","BMI","ACS"), var_cov = c("hypertension”,”diabetes"), data = df)

jinseob2kim commented 4 months ago

Hi, I tried updating the latest version, remotes::install_github(‘jinseob2kim/jstable’), but it still prompts Error in purrr::map(., ~survival::survfit(formula.km, data = .)) : ℹ In index: 3. ℹ With name: st. Caused by error in survfit.formula():

I fix the issue. please install the latest version via remotes::install_github("jinseob2kim/jstable")我解决了这个问题。请通过以下方式 remotes::install_github("jinseob2kim/jstable") 安装最新版本

Could you share the example data and code?

Sure df <- aa %>% select(time,status,group,age,BMI,hypertension,diabetes,ACS) %>% mutate(status = as.integer(status == 1), age = ifelse(age <65,"<65",">=65"), age = factor(age, levels = c("<65",">=65")), BMI = ifelse(BMI <28,"<28", ">= 28"), BMI = factor(BMI, levels = c("<28", ">= 28")), hypertension = factor(hypertension, levels = c(0, 1), labels = c("No", "Yes")), diabetes = factor(diabetes, levels = c(0, 1), labels = c("No", "Yes")), ACS=factor(ACS, levels=c(1,2,3,4),labels=c("non","ua","st","nst"))) res <- TableSubgroupMultiCox(formula = Surv(time, status) ~ group, var_subgroups = c("age","BMI","ACS"), var_cov = c("hypertension”,”diabetes"), data = df)

Please share the example data for reproducibility. I think the problem is "N of 3rd level group variable"

Cextra commented 4 months ago

aa.xlsx

wognsths commented 4 months ago

aa.xlsx

The error was identified to occur while applying the subgroup option that some items in the subgroup did not exist in the data. The issue has been corrected. Please verify.

Cextra commented 4 months ago

aa.xlsx

The error was identified to occur while applying the subgroup option that some items in the subgroup did not exist in the data. The issue has been corrected. Please verify.在应用子组选项时,发现数据中不存在子组中的某些项目时发生错误。此问题已得到纠正。请验证。

Thanks, I corrected my mistake and was able to complete it without any problems