### Install QRISK3 from CRAN Source: https://github.com/yanliuk/qrisk3/blob/master/README.md Install the QRISK3 package from CRAN. ```r install.packages("QRISK3") ``` -------------------------------- ### Install QRISK3 from GitHub Source: https://github.com/yanliuk/qrisk3/blob/master/README.md Install the QRISK3 package from GitHub using devtools. ```r install.packages("devtools") library(devtools) install_github("YanLiUK/QRISK3") ``` -------------------------------- ### QRISK3_2017 Source: https://github.com/yanliuk/qrisk3/blob/master/man/QRISK3_2017.Rd Documentation for the QRISK3_2017 R function, including usage, arguments, return value, and an example. ```APIDOC ## QRISK3_2017 ### Description Calculates the 10-year individual cardiovascular disease (CVD) risk using the QRISK3-2017 algorithm. ### Usage ```r QRISK3_2017( data, patid, gender, age, atrial_fibrillation, atypical_antipsy, regular_steroid_tablets, erectile_disfunction, migraine, rheumatoid_arthritis, chronic_kidney_disease, severe_mental_illness, systemic_lupus_erythematosis, blood_pressure_treatment, diabetes1, diabetes2, weight, height, ethiniciy, heart_attack_relative, cholesterol_HDL_ratio, systolic_blood_pressure, std_systolic_blood_pressure, smoke, townsend ) ``` ### Arguments - **data** - Specify your data. - **patid** - Specify the patient identifier. - **gender** - 1: women, 0: men. - **age** - Age of the patient in years (e.g., 64). - **atrial_fibrillation** - Atrial fibrillation? (0: No, 1: Yes). - **atypical_antipsy** - On atypical antipsychotic medication? (0: No, 1: Yes). - **regular_steroid_tablets** - On regular steroid tablets? (0: No, 1: Yes). - **erectile_disfunction** - Diagnosis of or treatment for erectile dysfunction? (0: No, 1: Yes). - **migraine** - Do patients have migraines? (0: No, 1: Yes). - **rheumatoid_arthritis** - Rheumatoid arthritis? (0: No, 1: Yes). - **chronic_kidney_disease** - Chronic kidney disease (stage 3, 4, or 5)? (0: No, 1: Yes). - **severe_mental_illness** - Severe mental illness? (0: No, 1: Yes). - **systemic_lupus_erythematosis** - Systemic lupus erythematosus (SLE)? (0: No, 1: Yes). - **blood_pressure_treatment** - On blood pressure treatment? (0: No, 1: Yes). - **diabetes1** - Diabetes status: type 1? (0: No, 1: Yes). - **diabetes2** - Diabetes status: type 2? (0: No, 1: Yes). - **weight** - Weight of patients (kg). - **height** - Height of patients (cm). - **ethiniciy** - Ethnic group coded as QRISK3: 1 White or not stated, 2 Indian, 3 Pakistani, 4 Bangladeshi, 5 Other Asian, 6 Black Caribbean, 7 Black African, 8 Chinese, 9 Other ethnic group. - **heart_attack_relative** - Angina or heart attack in a 1st degree relative < 60? (0: No, 1: Yes). - **cholesterol_HDL_ratio** - Cholesterol/HDL ratio (range 1 to 11, e.g., 4). - **systolic_blood_pressure** - Systolic blood pressure (mmHg, e.g., 180). - **std_systolic_blood_pressure** - Standard deviation of at least two most recent systolic blood pressure readings (mmHg). - **smoke** - Smoke status coded as QRISK3: 1 non-smoker, 2 ex-smoker, 3 light smoker (<10), 4 moderate smoker (10-19), 5 heavy smoker (20 or over). - **townsend** - Townsend deprivation scores. ### Value Returns a dataset with three columns: patient identifier, calculated QRISK3 score, and calculated QRISK3 score with only 1 digit. ### Example ```r data(QRISK3_2019_test) test_all <- QRISK3_2019_test test_all_rst <- QRISK3_2017(data=test_all, patid="ID", gender="gender", age="age", atrial_fibrillation="b_AF", atypical_antipsy="b_atypicalantipsy", regular_steroid_tablets="b_corticosteroids", erectile_disfunction="b_impotence2", migraine="b_migraine", rheumatoid_arthritis="b_ra", chronic_kidney_disease="b_renal", severe_mental_illness="b_semi", systemic_lupus_erythematosis="b_sle", blood_pressure_treatment="b_treatedhyp", diabetes1="b_type1", diabetes2="b_type2", weight="weight", height="height", ethiniciy="ethrisk", heart_attack_relative="fh_cvd", cholesterol_HDL_ratio="rati", systolic_blood_pressure="sbp", std_systolic_blood_pressure="sbps5", smoke="smoke_cat", townsend="town") test_all_rst$"QRISK_C_algorithm_score" <- test_all$"QRISK_C_algorithm_score" test_all_rst$"diff" <- test_all_rst$"QRISK3_2017_1digit" - test_all_rst$"QRISK_C_algorithm_score" print(test_all_rst$"diff") print(identical(test_all_rst$"QRISK3_2017_1digit", test_all_rst$"QRISK_C_algorithm_score")) ``` ``` -------------------------------- ### Calculate QRISK3 risk and compare with reference scores Source: https://github.com/yanliuk/qrisk3/blob/master/README.md Example of calculating 10-year CVD risk using the QRISK3_2017 function on the included test dataset. It maps column names to the required variables, then compares the computed scores against the reference QRISK_C_algorithm_score column and prints the differences and identity check. ```r data(QRISK3_2019_test) test_all <- QRISK3_2019_test test_all_rst <- QRISK3_2017(data=test_all, patid="ID", gender="gender", age="age", atrial_fibrillation="b_AF", atypical_antipsy="b_atypicalantipsy", regular_steroid_tablets="b_corticosteroids", erectile_disfunction="b_impotence2", migraine="b_migraine", rheumatoid_arthritis="b_ra", chronic_kidney_disease="b_renal", severe_mental_illness="b_semi", systemic_lupus_erythematosis="b_sle", blood_pressure_treatment="b_treatedhyp", diabetes1="b_type1", diabetes2="b_type2", weight="weight", height="height", ethiniciy="ethrisk", heart_attack_relative="fh_cvd", cholesterol_HDL_ratio="rati", systolic_blood_pressure="sbp", std_systolic_blood_pressure="sbps5", smoke="smoke_cat", townsend="town") test_all_rst$"QRISK_C_algorithm_score" <- test_all$"QRISK_C_algorithm_score" test_all_rst$"diff" <- test_all_rst$"QRISK3_2017_1digit" - test_all_rst$"QRISK_C_algorithm_score" print(test_all_rst$"diff") print(identical(test_all_rst$"QRISK3_2017_1digit", test_all_rst$"QRISK_C_algorithm_score")) ``` -------------------------------- ### Load and inspect QRISK3_2019_test dataset Source: https://github.com/yanliuk/qrisk3/blob/master/man/QRISK3_2019_test.Rd Loads the QRISK3_2019_test dataset and displays its structure. Use this to verify the dataset is available and to view its columns and types. ```r data(QRISK3_2019_test) str(QRISK3_2019_test) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.