The analysis relies on a set of open-source R packages for data management, cohort construction, visualization, and statistical modeling. These libraries were selected based on their stability, community support, and suitability for large-scale longitudinal health data.
Click to show/hide R Code
# Libraries necessary for the analysis#File import librarieslibrary(haven)library(readr)library(readxl)#File export librarieslibrary(writexl)#Data management librarieslibrary(tidyverse)library(labelled)library(dplyr)library(tidyr)library(janitor)library(purrr)library(lubridate)library(conflicted)#Core library for the SRTRlibrary(sRtr)#Flowchart librarieslibrary(strobe)library(flowchart)#Statistical modeling librarieslibrary(MatchIt)library(survival)library(MASS)library(sandwich)library(lmtest)#Table librarieslibrary(gtsummary)library(gt)#Plotting librarieslibrary(ggplot2)library(survminer)#Use the conflicted package to ensure that the select and filter functions are not supersededconflict_prefer("select", "dplyr")conflict_prefer("filter", "dplyr")conflict_prefer("lag", "dplyr")
The table below lists the required packages along with links to their primary documentation.
Required R Packages
Libraries used for data processing, visualization, and statistical modeling