This commit is contained in:
Louis Chih-Ming Lee 2026-05-19 17:25:57 +02:00
parent 6d492e0990
commit 8629a52530
4 changed files with 402 additions and 106 deletions

View file

@ -14,6 +14,7 @@ library(survival)
library(emmeans)
library(foreign)
library(gtsummary)
library(ggsurvfit)
```
```{r}
@ -114,6 +115,29 @@ table.split <- dat.table1 |>
table.split
```
```{r}
table.split <- dat.table1 |>
select(sex, age.rec, age.donor, hla.match, cold.isc, tx.type) |>
tbl_summary(
by = tx.type,
statistic = list(
all_continuous() ~ "{median} ({p25}, {p75})"
),
label = list(
hla.match ~ "HLA matches, n(%)",
age.donor ~ "Donor age, median (IQR)",
age.rec ~ "Recipient age, median (IQR)",
cold.isc ~ "Cold ischemic time (hours), median (IQR), ",
sex ~ "Sex, n(%)"
),
missing = "ifany"
) |>
add_overall() |>
modify_footnote(all_stat_cols() ~ NA)
table.split
```
Calculate median follow-up (reverse Kaplan-Meier method), with 95% CI
```{r}
@ -367,9 +391,6 @@ recode.dat <- function(dat, time.intervals) {
df
}
```
```{r}
@ -547,13 +568,16 @@ dat.age.rec$age.group <- sapply(dat.age.rec$age.rec, class.age) |>
cox.age.rec <- coxph(Surv(follow.up, death) ~ age.group, data = dat.age.rec)
cox.age.rec |> summary()
```
```{r}
emmeans(cox.age.rec, pairwise ~ age.group, type = "response")
```
```{r}
cox.age.rec |> ggsurvfit()
```
# Exercise 7