load('data/lca_clinical.rda')
load('data/lca_cna.grch37.rda')
load('data/lca_mutations.grch37.rda')
suppressPackageStartupMessages(library(survminer))
suppressPackageStartupMessages(library(survival))
head(lca_clinical)
##   patient_id histology cause_of_death time_from_surgery_to_event_months
## 1          1         2              3                              6.50
## 2          3         2              2                             88.47
## 3          4         1              2                             27.57
## 4          6         1           <NA>                            135.83
## 5          7         1              3                             79.67
## 6          8         1              1                            135.63
##   status_dfs lung_event time_to_death_months egfr_status_diagnostic
## 1          1          0                 6.50                     ND
## 2          1          1                89.57                     WT
## 3          1          1                47.87                     WT
## 4          0          0               135.83                   <NA>
## 5          1          0                79.67                     WT
## 6          0          0               135.63                     WT
##   kras_status_diagnostic OUS_sample_id stage tobacco gender
## 1                     ND          001T     2       3      1
## 2                     WT          003T     1       2      1
## 3                     ND          004T     3       2      2
## 4                     WT          <NA>    NA      NA     NA
## 5                     WT          <NA>     3       2      1
## 6                   G12C          008T     1       2      1
##   tobacco_pack_years  age tumor_size_cm     KRAS
## 1              48.00 79.7           3.0 WildType
## 2              52.00 74.7           1.2 WildType
## 3              27.75 55.0           1.8 WildType
## 4                 NA   NA            NA WildType
## 5              45.75 71.1           5.0 WildType
## 6              24.00 47.8           0.9      G12

R Markdown

library(survminer)
library(survival)

smokers <- dplyr::filter(lca_clinical, tobacco == 2 | tobacco == 3)
nonsmokers <- dplyr::filter(lca_clinical, tobacco == 1)
fit <- survfit(Surv(time_to_death_months, status_dfs) ~ KRAS, data = lca_clinical)
ggsurvplot(fit, data = lca_clinical, pval = T)

fit2 <- survfit(Surv(time_to_death_months, status_dfs) ~ egfr_status_diagnostic, data = lca_clinical)
ggsurvplot(fit2, data = lca_clinical, pval = T)