Skip to content

Commit

Permalink
update figure and tab labels and footnotes
Browse files Browse the repository at this point in the history
  • Loading branch information
marianschmidt committed Oct 18, 2021
1 parent 2716866 commit cfcb696
Show file tree
Hide file tree
Showing 2 changed files with 524 additions and 521 deletions.
64 changes: 32 additions & 32 deletions 2_scripts/01.an_analyses.spc.lung.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,7 @@ tab1_gt <- tab1_pre %>%
rows = c(5, 6, 11))
) %>%
tab_source_note(
source_note = paste0(if(en_gb){"ASIR age-standardised incidence rate based on the European Standard Population 1976 for the population aged 30+; "}else{"ASIR age-standardized incidence rate based on the European Standard Population 1976 for the population aged 30+; "}, "DCO death-certificate only; ", "FU follow-up; ", "LC primary lung cancer; ", "NSCLC non-small-cell lung carcinoma; ", "PYAR person-years at risk; ", "SPC second primary cancer")
source_note = paste0(if(en_gb){"ASIR age-standardised incidence rate based on the European Standard Population 1976 for the population aged 30+; "}else{"ASIR age-standardized incidence rate based on the European Standard Population 1976 for the population aged 30+; "}, "DCO death-certificate only; ", "IR incidence rate; ", "LC primary lung cancer; ", "NSCLC non-small-cell lung carcinoma; ", "PYAR person-years at risk; ", "SPC second primary cancer")
) %>%
#special formatting
#global table options
Expand Down Expand Up @@ -2525,10 +2525,9 @@ fig1_row2_splot <- sir_sum_fig1 %>%
, vlab_x_off = -0.38)
fig1_row3_splot <- sir_sum_fig1 %>%
#add note to Lung cancer SIR
dplyr::mutate(t_site = dplyr::case_when(
t_site == "Lung (C33-C34)" ~ "Lung*** (C33-C34)",
TRUE ~ as.character(t_site))) %>%
#add note to Lung cancer SIR
dplyr::mutate(t_site = forcats::fct_recode(
t_site, "Lung*** (C33-C34)" = "Lung (C33-C34)")) %>%
plot_sir_byfutime(., sites_to_plot = fig1_site_row3, y_lim = fig1_max_sir
, vlab_x_off = -0.38, vlab_y_pos = 0.47)
Expand Down Expand Up @@ -2571,8 +2570,8 @@ fig1_sum_smo_splot <-
mutate(fu_time = recode(fu_time, "Total 0.5 to Inf years" = "Total")) %>%
#rename Total t_site
mutate(t_site := recode(t_site,
"smoking-related IARC" = "Smoking-related cancers (*)",
"other cancer" = "Other cancers (**)"
"smoking-related IARC" = "Smoking-related cancers*",
"other cancer" = "Other cancers**"
)) %>%
#start ggplot
ggplot(data =., aes(x=fu_time, y=sir, colour=sex, group=sex, shape = fewcases)) +
Expand Down Expand Up @@ -2645,8 +2644,8 @@ fig1_sum_oth_splot <-
mutate(fu_time = recode(fu_time, "Total 0.5 to Inf years" = "Total")) %>%
#rename Total t_site
mutate(t_site := recode(t_site,
"smoking-related IARC" = "Smoking-related cancers (*)",
"other cancer" = "Other cancers (**)"
"smoking-related IARC" = "Smoking-related cancers*",
"other cancer" = "Other cancers**"
)) %>%
#start ggplot
ggplot(data =., aes(x=fu_time, y=sir, colour=sex, group=sex, shape = fewcases)) +
Expand Down Expand Up @@ -2743,9 +2742,10 @@ fig1 <- wrap_plots(A = fig1_sum_smo_splot,
caption = element_text(
"Notes: SIR is only calculated for strata with at least 5 expected cases. Numeric SIR values are given for total follow-up time (6 months to 10+ years).
Showing all sites with at least 70 observed or expected cases for males or 30 observed or expected cases for females for total follow-up time.
* Total for \"Smoking-related cancers\" includes all SPC with locations C01-C06, C10-C14 C15-16, C18-20, C22, C25, C30, C31, C32, C33-34, C53, C56, C64, C65-68, C92.
** Total for \"Other cancers\" includes all other locations.
*** SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer (see Discussion section)."),
* Total for \"Smoking-related cancers\" includes all SPC with locations C01-C06, C10-C14 C15-16, C18-20, C22, C25, C30, C31, C32, C33-34, C53, C56, C64, C65-68, C92.
** Total for \"Other cancers\" includes all other locations.
*** The registration of a second primary lung cancer followed the IARC international rules for multiple primary cancers. SIR for lung cancer may be underestimated due to
the histology-dependent registration of SPC with the same location as the first cancer."),
theme = theme(plot.caption = element_text(hjust = 0), #left alignment of caption
plot.title = element_text(size = 16))
)
Expand Down Expand Up @@ -3124,7 +3124,7 @@ tab2_gt <- tab2_pre %>%
col_end = all_of("10+ years__sir_uci")
) %>%
tab_source_note(
source_note = paste0("Notes: ", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "FU follow-up; ", "LC primary lung cancer; ", "NSCLC non-small-cell lung carcinoma; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer")
source_note = paste0("Notes: ", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "LC primary lung cancer; ", "NSCLC non-small-cell lung carcinoma; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer")
) %>%
#special formatting
##make column and row group labels bold
Expand Down Expand Up @@ -5261,7 +5261,7 @@ supp_tab_sites_m_gt <- supp_sir_sum_tab_sites %>%
col_end = all_of("10+ years__sir_uci")
) %>%
tab_source_note(
source_note = paste0("Notes: ", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer; ", "🚬 smoking-related cancer site; ", "x censored counts of expected and observed smaller than 5 for data privacy reasons; ", "* SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer (see Discussion section).")
source_note = paste0("Notes: ", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer; ", "🚬 smoking-related cancer site; ", "x censored counts of expected and observed smaller than 5 for data privacy reasons; ", "* The registration of a second primary lung cancer followed the IARC international rules for multiple primary cancers. SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer.")
) %>%
#special formatting
##make column and row group labels bold
Expand Down Expand Up @@ -5597,7 +5597,7 @@ supp_tab_sites_f_gt <- supp_sir_sum_tab_sites %>%
col_end = all_of("10+ years__sir_uci")
) %>%
tab_source_note(
source_note = paste0("Notes: ", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer; ", "🚬 smoking-related cancer site; ", "x censored counts of expected and observed smaller than 5 for data privacy reasons; ", "* SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer (see Discussion section).")
source_note = paste0("Notes: ", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer; ", "🚬 smoking-related cancer site; ", "x censored counts of expected and observed smaller than 5 for data privacy reasons; ", "* The registration of a second primary lung cancer followed the IARC international rules for multiple primary cancers. SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer.")
) %>%
#special formatting
##make column and row group labels bold
Expand Down Expand Up @@ -5930,7 +5930,7 @@ sens1_nodco_tab_gt <- sens1_nodco_tab %>%
col_end = all_of("10+ years__sir_uci")
) %>%
tab_source_note(
source_note = paste0("Notes: This sensitivity analysis excluded DCO cases from the observed counts and calculated expected cases using reference rates without DCO", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer; ", "🚬 smoking-related cancer site; ", "x censored counts of expected and observed smaller than 5 for data privacy reasons; ", "* SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer (see Discussion section).")
source_note = paste0("Notes: This sensitivity analysis excluded DCO cases from the observed counts and calculated expected cases using reference rates without DCO. ", "DCO death certificate only; ", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer; ", "🚬 smoking-related cancer site; ", "x censored counts of expected and observed smaller than 5 for data privacy reasons; ", "* The registration of a second primary lung cancer followed the IARC international rules for multiple primary cancers. SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer.")
) %>%
#special formatting
##make column and row group labels bold
Expand Down Expand Up @@ -6272,7 +6272,7 @@ sens2_lowdcorate_tab_gt <- sens2_lowdcorate_tab %>%
col_end = all_of("10+ years__sir_uci")
) %>%
tab_source_note(
source_note = paste0("Notes: The six included registries are Brandenburg 2007 to 2014, Bremen 2004 to 2014, Hamburg 2008 to 2014, Mecklenburg-Western Pomerania 2003 to 2011, Saarland 2002 to 2011 and Saxony 2005 to 2014.", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer; ", "🚬 smoking-related cancer site; ", "x censored counts of expected and observed smaller than 5 for data privacy reasons; ", "* SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer (see Discussion section).")
source_note = paste0("Notes: The six included registries are Brandenburg 2007 to 2014, Bremen 2004 to 2014, Hamburg 2008 to 2014, Mecklenburg-Western Pomerania 2003 to 2011, Saarland 2002 to 2011 and Saxony 2005 to 2014. ", "DCO death certificate only; ", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer; ", "🚬 smoking-related cancer site; ", "x censored counts of expected and observed smaller than 5 for data privacy reasons; ", "* The registration of a second primary lung cancer followed the IARC international rules for multiple primary cancers. SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer.")
) %>%
#special formatting
##make column and row group labels bold
Expand Down Expand Up @@ -6414,9 +6414,8 @@ sens2_lowdcorate_figX2_row2_splot <- sens2_lowdcorate_figX2_results %>%
sens2_lowdcorate_figX2_row3_splot <- sens2_lowdcorate_figX2_results %>%
#add note to Lung cancer SIR
dplyr::mutate(t_site = dplyr::case_when(
t_site == "Lung (C33-C34)" ~ "Lung*** (C33-C34)",
TRUE ~ as.character(t_site))) %>%
dplyr::mutate(t_site = forcats::fct_recode(
t_site, "Lung*** (C33-C34)" = "Lung (C33-C34)")) %>%
plot_sir_byfutime(., sites_to_plot = sens2_lowdcorate_figX2_site_row3, y_lim = supp_figX2_sir_max)
sens2_lowdcorate_figX2_row4_splot <- sens2_lowdcorate_figX2_results %>%
Expand Down Expand Up @@ -6451,9 +6450,10 @@ sens2_lowdcorate_figX2 <- sens2_lowdcorate_figX2_row1_splot +
"Notes: The six included registries are Brandenburg 2007 to 2014, Bremen 2004 to 2014, Hamburg 2008 to 2014,
Mecklenburg-Western Pomerania 2003 to 2011, Saarland 2002 to 2011 and Saxony 2005 to 2014.
SIR is only calculated for strata with at least 5 expected cases. Numeric values are given for total follow-up time (0 months to 10+ years).
* Total for \"Smoking-related cancers\" includes all SPC with locations C01-C06, C10-C14 C15-16, C18-20, C22, C25, C30-34, C53, C56, C64-67, C92.
** Total for \"Other cancers\" includes all other locations.
**** SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer (see Discussion section)."),
* Total for \"Smoking-related cancers\" includes all SPC with locations C01-C06, C10-C14 C15-16, C18-20, C22, C25, C30-34, C53, C56, C64-67, C92.
** Total for \"Other cancers\" includes all other locations.
*** The registration of a second primary lung cancer followed the IARC international rules for multiple primary cancers. SIR for lung cancer may be underestimated due to
the histology-dependent registration of SPC with the same location as the first cancer."),
theme = theme(plot.caption = element_text(hjust = 0),
#create common legend and axis labels
legend.position="bottom")) +
Expand Down Expand Up @@ -6792,10 +6792,9 @@ supp_figX1_row2_splot <- supp_figX1_results %>%
plot_sir_byfutime(., sites_to_plot = supp_figX1_site_row2, timecats_to_plot = c("to 6 months", "6-12 months", "1-5 years", "5-10 years", "Total"), y_lim = supp_figX1_sir_max, vlab_y_pos = 0.6, vlab_y_diff = 0.15)
supp_figX1_row3_splot <- supp_figX1_results %>%
#add note to Lung cancer SIR
dplyr::mutate(t_site = dplyr::case_when(
t_site == "Lung (C33-C34)" ~ "Lung*** (C33-C34)",
TRUE ~ as.character(t_site))) %>%
#add note to Lung cancer SIR
dplyr::mutate(t_site = forcats::fct_recode(
t_site, "Lung*** (C33-C34)" = "Lung (C33-C34)")) %>%
plot_sir_byfutime(., sites_to_plot = supp_figX1_site_row3, timecats_to_plot = c("to 6 months", "6-12 months", "1-5 years", "5-10 years", "Total"), y_lim = supp_figX1_sir_max, vlab_x_off = -0.6, vlab_y_diff = 0.13)
supp_figX1_row4_splot <- supp_figX1_results %>%
Expand Down Expand Up @@ -6827,9 +6826,10 @@ supp_figX1 <- supp_figX1_row1_splot + supp_figX1_row2_splot + supp_figX1_row3_sp
including lung cancer patients with less than 6 months follow-up (n=", format(nrow(d2_zlung_wide), big.mark = ","), ")")),
caption = element_text(
"Notes: SIR is only calculated for strata with at least 5 expected cases. Numeric SIR values are given for total follow-up time (0 months to 10+ years).
* Total for \"Smoking-related cancers\" includes all SPC with locations C01-C06, C10-C14 C15-16, C18-20, C22, C25, C30-34, C53, C56, C64-67, C92.
** Total for \"Other cancers\" includes all other locations.
*** SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer (see Discussion section)."),
* Total for \"Smoking-related cancers\" includes all SPC with locations C01-C06, C10-C14 C15-16, C18-20, C22, C25, C30-34, C53, C56, C64-67, C92.
** Total for \"Other cancers\" includes all other locations.
*** The registration of a second primary lung cancer followed the IARC international rules for multiple primary cancers. SIR for lung cancer may be
underestimated due to the histology-dependent registration of SPC with the same location as the first cancer."),
theme = theme(plot.caption = element_text(hjust = 0)) #left alignment of caption
)
Expand Down Expand Up @@ -7179,7 +7179,7 @@ supp_tabX2_pt1_gt <- supp_tabX2_pt1 %>%
col_end = all_of("10+ years__sir_uci")
) %>%
tab_source_note(
source_note = paste0("Notes: ", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "FU follow-up; ", "LC primary lung cancer; ", "NSCLC non-small-cell lung carcinoma; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer; ", "x censored counts of expected and observed smaller than 5 for data privacy reasons")
source_note = paste0("Notes: ", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "LC primary lung cancer; ", "NSCLC non-small-cell lung carcinoma; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer; ", "x censored counts of expected and observed smaller than 5 for data privacy reasons")
) %>%
#special formatting
##make column and row group labels bold
Expand Down Expand Up @@ -7397,7 +7397,7 @@ supp_tabX2_pt2_gt <- supp_tabX2_pt2 %>%
col_end = all_of("10+ years__sir_uci")
) %>%
tab_source_note(
source_note = paste0("Notes: ", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "FU follow-up; ", "LC primary lung cancer; ", "NSCLC non-small-cell lung carcinoma; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer; ", "x censored counts of expected and observed smaller than 5 for data privacy reasons; ", "* SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer (see Discussion section).")
source_note = paste0("Notes: ", "E number of cases expected according to age-, sex-, region- and period-specific reference rates for the general population; ", "LC primary lung cancer; ", "NSCLC non-small-cell lung carcinoma; ", "O number of cases observed in the data; " ,"PYAR person-years at risk; ", if(en_gb){"SIR standardised incidence ratio; "}else{"SIR standardized incidence ratio; "}, "SPC second primary cancer; ", "x censored counts of expected and observed smaller than 5 for data privacy reasons; ", "* The registration of a second primary lung cancer followed the IARC international rules for multiple primary cancers. SIR for lung cancer may be underestimated due to the histology-dependent registration of SPC with the same location as the first cancer.")
) %>%
#special formatting
##make column and row group labels bold
Expand Down
Loading

0 comments on commit cfcb696

Please sign in to comment.