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

visr.survfit() strata label update? #343

Closed
ddsjoberg opened this issue Mar 14, 2022 · 3 comments · Fixed by #348
Closed

visr.survfit() strata label update? #343

ddsjoberg opened this issue Mar 14, 2022 · 3 comments · Fixed by #348
Assignees
Labels
issue Used for project filtering
Milestone

Comments

@ddsjoberg
Copy link
Collaborator

The default label in the KM curve includes the variable name. This labeling comes from the default output in survfit().

image

But, it's difficult to imagine a scenario where anyone would want the variable name prefix in the figure. Because we have total control of the inputs with estimate_KM(), we can pretty easily update this to only include the levels without the "varname=" prefix. When there are multiple stratifying variables we can use the interaction() function to construct a more beautiful stratifying variable to include.

interaction(gtsummary::trial$stage, gtsummary::trial$grade, sep = ", ") |> levels()
#>  [1] "T1, I"   "T2, I"   "T3, I"   "T4, I"   "T1, II"  "T2, II"  "T3, II" 
#>  [8] "T4, II"  "T1, III" "T2, III" "T3, III" "T4, III"

Created on 2022-03-14 by the reprex package (v2.0.1)

Also, what do you think about making the default strata label a blank space instead of include "strata" above the levels for every plot?

@ddsjoberg ddsjoberg added the issue Used for project filtering label Mar 14, 2022
@ddsjoberg
Copy link
Collaborator Author

I started some updates in a branch called "strata_lbl_updates". So far the "variable_name=" prefix in the legend is removed (and works when there is more than one stratifying variable). I think the output is preferable....thoughts?

image

@SHAESEN2
Copy link
Collaborator

It was a conscious decision to keep it in. In our clinical trials we might switch between planned and actual treatment for a subject during analysis. To be very explicit this strata label is useful TRTA = vs TRTP =

@ddsjoberg
Copy link
Collaborator Author

ddsjoberg commented Mar 28, 2022

That is a very good point! It's important the labeling is clear. I am trying to think of ways that we can keep the messaging clear, but also customizable. I know in my work (including the randomized trials I report on) we would never publish a figure using a raw variable name.

What do you think of dropping the variable name from the levels, and add it to the legend. This way, users have control over whether they want to keep the variable name in the levels or not. In the current state, it can't be customized.

image

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

Successfully merging a pull request may close this issue.

3 participants