Comments (2)
Hi @fenguoerbian,
Sorry for the confusion in the documentation (I'll update it accordingly), the label_all
parameter should actuallly be assigned in the call(s) of extract_survival_subgroups
. See the updated example below:
library(dplyr)
library(forcats)
library(tern)
adtte <- tern_ex_adtte
# Save variable labels before data processing steps.
adtte_labels <- formatters::var_labels(adtte)
adtte_f <- adtte %>%
filter(
PARAMCD == "OS",
ARM %in% c("B: Placebo", "A: Drug X"),
SEX %in% c("M", "F")
) %>%
mutate(
# Reorder levels of ARM to display reference arm before treatment arm.
ARM = droplevels(fct_relevel(ARM, "B: Placebo")),
SEX = droplevels(SEX),
AVALU = as.character(AVALU),
is_event = CNSR == 0
)
labels <- c(
"ARM" = adtte_labels[["ARM"]],
"SEX" = adtte_labels[["SEX"]],
"AVALU" = adtte_labels[["AVALU"]],
"is_event" = "Event Flag"
)
formatters::var_labels(adtte_f)[names(labels)] <- labels
df <- extract_survival_subgroups(
variables = list(
tte = "AVAL",
is_event = "is_event",
arm = "ARM", subgroups = c("SEX", "BMRKR2")
),
data = adtte_f,
label_all = "Full Analysis Set"
)
df_grouped <- extract_survival_subgroups(
variables = list(
tte = "AVAL",
is_event = "is_event",
arm = "ARM", subgroups = c("SEX", "BMRKR2")
),
data = adtte_f,
groups_lists = list(
BMRKR2 = list(
"low" = "LOW",
"low/medium" = c("LOW", "MEDIUM"),
"low/medium/high" = c("LOW", "MEDIUM", "HIGH")
)
),
label_all = "Full Analysis Set"
)
## Table with default columns.
basic_table() %>%
tabulate_survival_subgroups(df, time_unit = adtte_f$AVALU[1])
#> B: Placebo A: Drug X
#> Baseline Risk Factors Total Events Events Median (DAYS) Events Median (DAYS) Hazard Ratio 95% Wald CI
#> ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
#> Full Analysis Set 101 57 727.8 44 974.6 0.71 (0.48, 1.06)
#> Sex
#> F 55 31 599.2 24 1016.3 0.56 (0.32, 0.96)
#> M 46 26 888.5 20 974.6 0.91 (0.50, 1.65)
#> Continuous Level Biomarker 2
#> LOW 36 21 735.5 15 974.6 0.76 (0.39, 1.51)
#> MEDIUM 31 14 731.8 17 964.2 0.77 (0.36, 1.61)
#> HIGH 34 22 654.8 12 1016.3 0.67 (0.33, 1.36)
Created on 2024-04-19 with reprex v2.1.0
from tern.
Thanks a lot!
from tern.
Related Issues (20)
- [Question]: More information needed on summarize_glm_count() HOT 3
- [bug] failing test
- Unknown issue with examples in max deps
- [Bug Report] `g_km` fails with multiple max time records HOT 2
- [CRAN Release]: 0.9.7
- CI green for https://github.com/pawelru/ie_status?tab=readme-ov-file HOT 1
- upversion emmeans to 1.10.4
- [Bug]: strange title wrapping for grobs HOT 1
- [Bug]: missing p-value HOT 2
- Question: how to align cell value to left or right? HOT 1
- Add `n_rate` statistic to `estimate_incidence_rate()`
- lgtm! Just need to fix url ;)
- Refactor `estimate_incidence_rate()` to work for analyze & summarize
- [Feature Request]: add confidence intervals for quantiles in surv_time
- Create or adapt an analysis function for injection rate HOT 3
- Complete deprecation of arguments deprecated <0.9.4 HOT 3
- [Feature Request]: add new statistics
- [RSPM]: <0.9.6>
- Move nestcolor from suggests to import
- investigate downstream breaking changes in chevron, initialize NA values HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tern.