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

Bug Report: inline_text(column) argument doesn't work with fct by level names #1883

Closed
stratopopolis opened this issue Aug 2, 2024 · 2 comments · Fixed by #1885
Closed

Comments

@stratopopolis
Copy link

Dear Mr. Sjoberg,
dear gtsummary Team,

I am creating a table by tbl_summary and use inline_text(), to use the results. Since an update using the colnames doesn't work, I am required to use "stat_1" instead. However, when I print the whole table, it shows the labels correctly.
This seems to be specific when using by= with factors

 Children2 <- tibble(
      "MTS_specific" = as_factor(sample(c("specific","nonspecific"), 100,T)),
      "Age_INT" = sample(1:18, 100,T),
      "Geschlecht_FCT" = as_factor(sample(c("male","female"), 100,T)),
      "AK_Entl_DT" =sample(1:180, 100,T)
    )

    results2 <- Children2 |>
      select("Diagramm" = MTS_specific, AK_Entl_DT, Age_INT, "Gender"=Geschlecht_FCT) |>
      tbl_summary(by="Diagramm",
              )
    #This works:
    inline_text(results2, variable = "Age_INT", column = "stat_1", pattern= "{median}")

    #This used to work (and is desired, again)
    inline_text(results2, variable = "Age_INT", column = "nonspecific", pattern= "{median}")
@ddsjoberg
Copy link
Owner

Thanks for the report, much appreciated. I'll investigate, but may not be able to for 2 weeks. In the meantime, it may be best to use the previous release of the package?

@ddsjoberg ddsjoberg changed the title Bug Report: <Describe bug> Bug Report: inline_text(column) argument doesn't work with fct by level names Aug 3, 2024
@ddsjoberg
Copy link
Owner

@stratopopolis a fix is in PR #1885. Can you test with your data?

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

Successfully merging a pull request may close this issue.

2 participants