Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Adding Variable Labels to "TableSubgroupMultiGLM" Output #49

Closed
zheng-gt opened this issue Nov 10, 2024 · 2 comments
Closed

Comments

@zheng-gt
Copy link

Dear Dr. Kim,

First, I want to thank you for developing the TableSubgroupMultiGLM function in the jstable package. It is an incredibly useful tool for conducting subgroup analyses and has greatly enhanced my workflow.

I have a suggestion that I believe would further enhance its functionality.

Currently, TableSubgroupMultiGLM does not apply the variable labels from the dataset to the results. Would it be possible to add an option for the function to utilize these labels in the output table?

Thank you for considering this request, and I look forward to any updates you may have.

@jinseob2kim
Copy link
Owner

I update the issue. Please install the latest version via

remotes::install_github(“jinseob2kim/jstable”)

But I use my own label function mk.lev, You can make label information via mk.lev(data) and update var_label & val_label. Example is the below.

library(survival)
library(dplyr)
lung %>%
  mutate(
    status = as.integer(status == 1),
    sex = factor(sex),
    kk = factor(as.integer(pat.karno >= 70))
  ) -> lung

lung$zz <- factor(lung$ph.ecog)
lung$kk1 <- factor(as.integer(lung$ph.karno >= 60))


labeldata <- jstable::mk.lev(lung)
labeldata[variable == "kk", `:=`(var_label = "label 1", val_label = c("No", "Yes"))]
labeldata[variable == "zz", `:=`(var_label = "label 2", val_label = c("a", "b", "b", "b"))]
labeldata[variable == "kk1", `:=`(var_label = "lable 3", val_label = c("No", "Yes"))]

TableSubgroupMultiGLM(status ~ sex, var_subgroups = c("kk", "kk1", "zz"), data = lung, family = "binomial", labeldata = labeldata)

@zheng-gt
Copy link
Author

zheng-gt commented Dec 7, 2024

@jinseob2kim Thank you very much. I will try it later. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants