Show the code
pings2_data <- dget("pings_2_data_with_bps_ready")pings2_data <- dget("pings_2_data_with_bps_ready")df_pings2_bp <-
pings2_data %>%
mutate(
female = a_gender == "Female",
nihss_levcon = str_extract(z_levcon, "^\\d+") %>% as.numeric(),
nihss_loc_quest = str_extract(z_loc_quest, "^\\d+") %>%
as.numeric(),
nihss_loc_comm = str_extract(z_loc_comm, "^\\d+") %>% as.numeric(),
nihss_bestgaze = str_extract(z_bestgaze, "^\\d+") %>% as.numeric(),
nihss_vfield = str_extract(z_vfield, "^\\d+") %>% as.numeric(),
nihss_facparesis = str_extract(z_facparesis, "^\\d+") %>%
as.numeric(),
nihss_motor_armr = str_extract(z_motor_armr, "^\\d+") %>%
as.numeric(),
nihss_motor_arml = str_extract(z_motor_arml, "^\\d+") %>%
as.numeric(),
nihss_motor_legr = str_extract(z_motor_legr, "^\\d+") %>%
as.numeric(),
nihss_motor_legl = str_extract(z_motor_legl, "^\\d+") %>%
as.numeric(),
nihss_limbataxia = str_extract(z_limbataxia, "^\\d+") %>%
as.numeric(),
nihss_pinprick = str_extract(z_pinprick, "^\\d+") %>% as.numeric(),
nihss_bestlang = str_extract(z_bestlang, "^\\d+") %>% as.numeric(),
nihss_dysarthria = str_extract(z_dysarthria, "^\\d+") %>%
as.numeric(),
nihss_extinction = str_extract(z_extinction, "^\\d+") %>%
as.numeric(),
nihss_scale = nihss_levcon + nihss_loc_quest + nihss_loc_comm +
nihss_bestgaze + nihss_vfield + nihss_facparesis +
nihss_motor_armr +
nihss_motor_arml + nihss_motor_legr + nihss_motor_legl +
nihss_limbataxia + nihss_pinprick + nihss_bestlang +
nihss_dysarthria + nihss_extinction,
ranking = str_extract(x_ranking, "\\d+") %>% as.numeric(),
dm = case_when(
ff_hba1c_0 > 6.5 ~ "Yes",
c_dm == "Yes" ~ "Yes",
h_antidm == "Yes" ~ "Yes",
ff_fbs_0 > 7 ~ "Yes",
eventname == "Baseline" ~ "No"),
hpt = case_when(
sbp >= 140 ~ "Yes",
dbp >= 90 ~ "Yes",
sbp < 140 ~ "No",
dbp < 90 ~ "No") %>% factor(),
hyperlipidemia = case_when(
c_hyperlip == "Yes" ~ "Yes",
h_antilipid == "Yes" ~ "Yes",
ff_totchol_0 > 5.17 ~ "Yes",
eventname == "Baseline" ~ "No"),
tobacco_use = case_when(g_tobacco %in% c(
"Formerly used tobacco products",
"Stopped after the stroke occurred",
"Currently uses tobacco products") ~ "Yes",
g_tobacco == "Never used tobacco products" ~ "No"),
obese_overwgt = case_when(
ee_bmi_0 >= 25 ~ "Yes",
ee_bmi_0 < 25 ~ "No"),
alcohol_curr = case_when(
g_alcohol == "Currently uses alcohol" ~ "Yes",
g_alcohol %in% c(
"Never used alcohol",
"Past 12 months",
"Past 30 days",
"Formerly used alcohol",
"Stopped after the stroke occured") ~ "No"),
alcohol_ever = case_when(
g_alcohol %in% c(
"Currently uses alcohol",
"Past 12 months",
"Past 30 days",
"Formerly used alcohol",
"Stopped after the stroke occured") ~ "Yes",
g_alcohol %in% c("Never used alcohol") ~ "No") %>%
factor(),
acei = i_acei_v2 == "Checked",
arb = i_arb_v2 == "Checked",
bb = i_bb_v2 == "Checked",
ccb = i_ccb_v2 == "Checked",
h_alpha_md = i_alpha_md_v2 == "Checked",
h_alpha_ab = i_alpha_ab_v2 == "Checked",
diuretics = i_diuretics_v2 == "Checked",
h_antiplt = i_antiplt_v2 == "Yes",
h_statins = i_statins_v2 == "Yes",
income2 = case_when(
a_income %in% c("0-100", "101-250", "251-500") ~ "<500 GHc",
a_income %in% c("501-1500", "1501-3000", "> 3000") ~
">= 500 GHc"),
educ2 = case_when(
a_formeduc %in% c("None", "Primary") ~ "None/Primary",
a_formeduc %in% c("Secondary", "Tertiary", "Postgraduate") ~
"Secondary or higher"),
agecat = case_when(
a_agebase < 60 ~ "<60", a_agebase >= 60 ~ ">=60"),
hosp_cat = case_when(
datagrp %in% c("CCTH SITE", "KATH SITE", "KORLE-BU SITE") ~
"Tertiary",
datagrp %in% c(
"KUMASI SOUTH HOSPITAL", "AGOGO SITE", "KNUST SITE") ~
"Secondary",
datagrp %in% c(
"ANKAASE SITE", "MANHYIA GOVT HOSPITAL", "KWADASO SITE",
"TAFO SITE") ~
"Primary"),
arm = case_when(
arm == "Arm 1- Intervention Arm" ~ "Intervention",
arm == "Arm 2- Routine Care" ~ "Routine"),
morisky_4_item = (unclass(k_forget) + unclass(k_miss) +
unclass(k_fine) + unclass(k_doctor)),
across(
c(l_forget, l_decide, l_salty, l_shake, l_fasfood, l_appoint,
l_missched, l_prescrip, l_runout, l_skipmed, l_feelbet,
l_feelsick, l_someone, l_careless),
.fns = ~factor(.x),
.names = "{.col}_unclassed"),
across(
c(l_forget_unclassed, l_decide_unclassed, l_salty_unclassed,
l_shake_unclassed, l_fasfood_unclassed, l_appoint_unclassed,
l_missched_unclassed, l_prescrip_unclassed, l_runout_unclassed,
l_skipmed_unclassed, l_feelbet_unclassed, l_feelsick_unclassed,
l_someone_unclassed, l_careless_unclassed),
.fns = ~unclass(.x)),
hillbone = (
l_forget_unclassed + l_decide_unclassed + l_salty_unclassed +
l_shake_unclassed + l_fasfood_unclassed + l_appoint_unclassed +
l_missched_unclassed + l_prescrip_unclassed +
l_runout_unclassed + l_skipmed_unclassed + l_feelbet_unclassed +
l_feelsick_unclassed + l_someone_unclassed +
l_careless_unclassed) %>%
as.numeric(),
aa_bp_115_75_corrrect = ifelse(
aa_bp_115_75 == "Normal", "Yes", "No"),
aa_bp160_100_correct = ifelse(
aa_bp160_100 == "High", "Yes", "No"),
aa_hptlasts_correct = ifelse(
aa_hptlasts == "The Rest of their Life", "Yes", "No"),
aa_hptmeds_correct = ifelse(aa_hptmeds == "Everyday", "Yes", "No"),
aa_losewght_correct = ifelse(aa_losewght == "Go Down", "Yes", "No"),
aa_eatsalt_correct = ifelse(aa_eatsalt == "Go Down", "Yes", "No"),
aa_hrtattack_correct = ifelse(aa_hrtattack == "Yes", "Yes", "No"),
aa_cancer_correct = ifelse(aa_cancer == "No", "Yes", "No"),
aa_stroke_correct = ifelse(aa_stroke == "Yes", "Yes", "No"),
aa_kidneyp_correct = ifelse(aa_kidneyp == "Yes", "Yes", "No"),
aa_highrisk_correct = ifelse(aa_highrisk == "Yes", "Yes", "No"),
aa_headache_correct = ifelse(aa_headache == "No", "Yes", "No"),
aa_feelgood_correct = ifelse(aa_feelgood == "Never", "Yes", "No"),
aa_strokeris_correct = ifelse(
aa_strokeris == "The Rest of Their Life", "Yes", "No"),
aa_hkq = (aa_bp_115_75_corrrect == "Yes") +
(aa_bp160_100_correct == "Yes") +
(aa_hptlasts_correct =="Yes") +
(aa_hptmeds_correct == "Yes") +
(aa_losewght_correct == "Yes") +
(aa_eatsalt_correct == "Yes") +
(aa_hrtattack_correct == "Yes") +
(aa_cancer_correct == "Yes") +
(aa_stroke_correct == "Yes") +
(aa_kidneyp_correct == "Yes") +
(aa_highrisk_correct == "Yes") +
(aa_headache_correct =="Yes") +
(aa_feelgood_correct =="Yes") +
(aa_strokeris_correct == "Yes"),
mobility = case_when(
str_detect(
p_mobility , "I have no problems in walking about") ~ "1",
str_detect(
p_mobility , "I have some problems in walking about") ~ "2",
str_detect(
p_mobility , "I am confined to bed") ~ "3")%>%
as.numeric(),
selfcare = case_when(
str_detect(
p_selfcare , "I have no problems with self-care") ~ "1",
str_detect(
p_selfcare , "I have some problems with washing or") ~ "2",
str_detect(
p_selfcare ,
"I am unable to wash or dress myself") ~ "3")%>%
as.numeric(),
usual_act = case_when(
str_detect(
p_usual_act ,
"I have no problems with performing my") ~ "1",
str_detect(
p_usual_act , "I have some problems with performing") ~ "2",
str_detect(
p_usual_act , "I am unable to perform my usual activitie") ~
"3")%>%
as.numeric(),
pain_disc = case_when(
str_detect(p_pain_disc , "I have no pain or discomfort") ~ "1",
str_detect(
p_pain_disc , "I have moderate pain or discomfort") ~ "2",
str_detect(
p_pain_disc ,
"I have extreme pain or discomfort") ~ "3") %>%
as.numeric(),
anxiety = case_when(
str_detect(p_anxiety, "I am not anxious or depressed") ~ "1",
str_detect(
p_anxiety, "I am moderately anxious or depressed") ~ "2",
str_detect(
p_anxiety, "I am extremely anxious or depressed") ~ "3")%>%
as.numeric(),
eq_5d = mobility + selfcare + usual_act + pain_disc + anxiety,
p_health = ifelse(p_health <= 1, p_health*100, p_health),
across(
c(bb_physical, bb_nutfacts, bb_repsalt, bb_limsalt, bb_tabsalt,
bb_eatsfood,
bb_broilst, bb_rsfoods, bb_rephfat, bb_totcal, bb_eatveges,
bb_alcohol,
bb_smoking, bb_bpathome, bb_fbpmeds, bb_takemeds, bb_wgtdown,
bb_monitst,
bb_streslow, bb_doctor, bb_physical2, bb_nutfacts2, bb_repsalt2,
bb_limsalt2,
bb_tabsalt2, bb_eatsfood2, bb_broilst2, bb_rsfoods2,
bb_rephfat2,
bb_totcal2,
bb_eatveges2, bb_alcohol2, bb_smoking2, bb_bpathome2,
bb_fbpmeds2,
bb_takemeds2,
bb_wgtdown2, bb_monitst2, bb_streslow2, bb_doctor2,
bb_physical3,
bb_nutfacts3,
bb_repsalt3, bb_limsalt3, bb_tabsalt3, bb_eatsfood3,
bb_broilst3,
bb_rsfoods3,
bb_rephfat3, bb_totcal3, bb_eatveges3, bb_alcohol3,
bb_smoking3,
bb_bpathome3,
bb_fbpmeds3, bb_takemeds3, bb_wgtdown3, bb_monitst3,
bb_streslow3,
bb_doctor3),
.fns = ~factor(.x),
.names = "{.col}_unclassed"),
across(
c(bb_physical_unclassed, bb_nutfacts_unclassed,
bb_repsalt_unclassed,
bb_limsalt_unclassed, bb_tabsalt_unclassed,
bb_eatsfood_unclassed,
bb_broilst_unclassed, bb_rsfoods_unclassed,
bb_rephfat_unclassed,
bb_totcal_unclassed, bb_eatveges_unclassed,
bb_alcohol_unclassed,
bb_smoking_unclassed, bb_bpathome_unclassed,
bb_fbpmeds_unclassed,
bb_takemeds_unclassed, bb_wgtdown_unclassed,
bb_monitst_unclassed,
bb_streslow_unclassed, bb_doctor_unclassed,
bb_physical2_unclassed,
bb_nutfacts2_unclassed, bb_repsalt2_unclassed,
bb_limsalt2_unclassed,
bb_tabsalt2_unclassed, bb_eatsfood2_unclassed,
bb_broilst2_unclassed,
bb_rsfoods2_unclassed, bb_rephfat2_unclassed,
bb_totcal2_unclassed,
bb_eatveges2_unclassed, bb_alcohol2_unclassed,
bb_smoking2_unclassed,
bb_bpathome2_unclassed, bb_fbpmeds2_unclassed,
bb_takemeds2_unclassed,
bb_wgtdown2_unclassed, bb_monitst2_unclassed,
bb_streslow2_unclassed,
bb_doctor2_unclassed, bb_physical3_unclassed,
bb_nutfacts3_unclassed,
bb_repsalt3_unclassed, bb_limsalt3_unclassed,
bb_tabsalt3_unclassed,
bb_eatsfood3_unclassed, bb_broilst3_unclassed,
bb_rsfoods3_unclassed,
bb_rephfat3_unclassed, bb_totcal3_unclassed,
bb_eatveges3_unclassed,
bb_alcohol3_unclassed, bb_smoking3_unclassed,
bb_bpathome3_unclassed,
bb_fbpmeds3_unclassed, bb_takemeds3_unclassed,
bb_wgtdown3_unclassed,
bb_monitst3_unclassed, bb_streslow3_unclassed,
bb_doctor3_unclassed),
.fns = ~unclass(.x)),
across(
c(bb_fbpmeds_unclassed, bb_takemeds_unclassed,
bb_fbpmeds2_unclassed, bb_takemeds2_unclassed,
bb_fbpmeds3_unclassed, bb_takemeds3_unclassed),
.fns = ~ 0 - .x + 5),
hpt_self_care = bb_physical_unclassed + bb_nutfacts_unclassed +
bb_repsalt_unclassed +
bb_limsalt_unclassed + bb_tabsalt_unclassed +
bb_eatsfood_unclassed +
bb_broilst_unclassed + bb_rsfoods_unclassed +
bb_rephfat_unclassed +
bb_totcal_unclassed + bb_eatveges_unclassed +
bb_alcohol_unclassed +
bb_smoking_unclassed + bb_bpathome_unclassed +
bb_fbpmeds_unclassed +
bb_takemeds_unclassed + bb_wgtdown_unclassed + bb_monitst_unclassed +
bb_streslow_unclassed + bb_doctor_unclassed + bb_physical2_unclassed +
bb_nutfacts2_unclassed + bb_repsalt2_unclassed + bb_limsalt2_unclassed +
bb_tabsalt2_unclassed + bb_eatsfood2_unclassed + bb_broilst2_unclassed +
bb_rsfoods2_unclassed + bb_rephfat2_unclassed + bb_totcal2_unclassed +
bb_eatveges2_unclassed + bb_alcohol2_unclassed + bb_smoking2_unclassed +
bb_bpathome2_unclassed + bb_fbpmeds2_unclassed + bb_takemeds2_unclassed +
bb_wgtdown2_unclassed + bb_monitst2_unclassed + bb_streslow2_unclassed +
bb_doctor2_unclassed + bb_physical3_unclassed + bb_nutfacts3_unclassed +
bb_repsalt3_unclassed + bb_limsalt3_unclassed + bb_tabsalt3_unclassed +
bb_eatsfood3_unclassed + bb_broilst3_unclassed + bb_rsfoods3_unclassed +
bb_rephfat3_unclassed + bb_totcal3_unclassed + bb_eatveges3_unclassed +
bb_alcohol3_unclassed + bb_smoking3_unclassed + bb_bpathome3_unclassed +
bb_fbpmeds3_unclassed + bb_takemeds3_unclassed + bb_wgtdown3_unclassed +
bb_monitst3_unclassed + bb_streslow3_unclassed + bb_doctor3_unclassed,
sbp_2 = sbp,
dbp_2 = dbp,
sbp_baseline = case_when(eventname == "Baseline" ~ sbp),
dbp_baseline = case_when(eventname == "Baseline" ~ dbp),
stroke_type = case_when(
d_st_type == "Ischemic Stroke" ~ "Ischemic",
d_st_type == "Intracerebral Hemorrhagic Stroke" ~ "Hemorrhagic") %>%
factor(),
hosp_cat2 = case_when(
hosp_cat %in% c("Primary","Secondary") ~ "Primary/Secondary",
hosp_cat == "Tertiary" ~ "Tertiary"),
egfr0 = parse_number(ff_egfr_0),
egfr0 = ifelse(egfr0 < 1, egfr0*100, egfr0),
egfr_cat = case_when(egfr0 < 60 ~ "<60", egfr0 >= 60 ~ ">=60"),
across(
c(m12_pratio_1, m12_pratio_2, m12_pratio_3, m12_pratio_4,
m12_pratio_5, m12_pratio_6, m12_pratio_7, m12_pratio_8),
~parse_number(.)),
emerg_visit = case_when(
gg_emerg_0 == "seizure" ~ "Yes",
gg_emerg_1 == "Stage III HPT" ~ "Yes",
gg_emerg_3 %in% c("Seizure","Yes") ~ "Yes",
gg_emerg_6 %in% c("seizure (recurrent stroke)", "YES") ~ "Yes",
eventname == "Baseline" ~ "No"),
emerg_visit = emerg_visit == "Yes",
mpr12 = rowMeans(
across(
c(m12_pratio_1, m12_pratio_2, m12_pratio_3, m12_pratio_4,
m12_pratio_5, m12_pratio_6, m12_pratio_7, m12_pratio_8)),
na.rm=T),
mpr12 = ifelse(mpr12 < 10, mpr12*10, mpr12),
mpr12 = ifelse(mpr12 > 200, mpr12/10, mpr12),
mpr12 = ifelse(mpr12 > 100, 100, mpr12),
sbp_base_cat = case_when(
sbp < 160 & eventname == "Baseline" ~ "<160mmHg",
sbp >= 160 & eventname == "Baseline" ~ ">=160mmHg")) %>%
arrange(pid, eventname) %>%
group_by(pid) %>%
fill(
sbp_2, dbp_2, arm, sbp_baseline, dbp_baseline, emerg_visit, dm,
d_st_type, arm) %>%
ungroup() %>%
mutate(
sbp_less_140_itt = sbp_2 < 140,
sbp_less_140_pp = sbp < 140,
bp_less_140_90_itt = (sbp_2 < 140 & dbp_2 < 90),
bp_less_140_90_pp = (sbp < 140 & dbp < 90),
sbp_diff = sbp_baseline - sbp,
dbp_diff = dbp_baseline - dbp,
sbp_diff_itt = sbp_baseline - sbp_2,
dbp_diff_itt = dbp_baseline - dbp_2,
sbp_less_135_itt = sbp_2 < 135,
sbp_less_135_pp = sbp < 135,
sbp_less_130_itt = sbp_2 < 130,
sbp_less_130_pp = sbp < 130,
review_no = case_when(
eventname == "Baseline" & !is.na(sbp) ~ 0,
eventname == "Month 1" & !is.na(sbp) ~ 1,
eventname == "Month 3" & !is.na(sbp) ~ 3,
eventname == "Month 6" & !is.na(sbp) ~ 6,
eventname == "Month 9" & !is.na(sbp) ~ 9,
eventname == "Month12" & !is.na(sbp) ~ 12)) %>%
arrange(pid, eventname) %>%
group_by(pid) %>%
mutate(
max_review = max(review_no, na.rm = T),
completed_study = case_when(
max_review == 12 ~ "Yes", TRUE ~ "No") %>% factor()) %>%
ungroup() %>%
mutate(
p_mobility, p_selfcare, p_usual_act, p_pain_disc,
p_anxiety, p_health,
r_hamd_total,
s_g10worth, s_g11help, s_g12depress, s_g13hope, s_h2control,
s_h3ability, s_h4things, s_h5overcome,
x_ranking,
z_levcon, z_loc_quest, z_loc_comm, z_bestgaze, z_vfield,
z_facparesis, z_motor_armr, z_motor_arml, z_motor_legr,
z_motor_legl, z_limbataxia, z_pinprick, z_bestlang,
z_dysarthria, z_extinction,
aa_bp_115_75:aa_strokeris,
ee_bmi_0, ee_sbp_0, ee_dbp_0, ee_waistc_0, ee_whrat_1, ee_hipc_0,
ee_bmi_0, ee_waistc_0, ee_wgt_0, ee_heightcm, ee_sbp_12,
ff_hba1c_0, ff_creat_0, ff_totchol_0, ff_ldl_0, ff_hdl_0,
ff_trigly_0, ff_egfr_0, ff_fbs_0
) %>%
mutate(
a_livingsit2 = case_when(
a_livingsit == "Lives Alone" ~ "Lives without family",
a_livingsit == "Lives With Spouse and Children" ~ "Lives with family",
a_livingsit == "Lives in a Nursing Home" ~ "Lives without family",
a_livingsit == "Lives With Spouse" ~ "Lives with family",
a_livingsit == "Lives With Extended Family" ~ "Lives with family",
a_livingsit == "Lives With Children" ~ "Lives with family"),
educ = fct_recode(a_formeduc, Tertiary = "Postgraduate"),
income = fct_collapse(
a_income, ">500" = c("501-1500", "1501-3000", "> 3000")),
maristat = fct_recode(
a_maristat, "Previously Married" = "Separated",
"Previously Married" = "Widow/Widower",
"Previously Married" = "Divorced",
"Currently Married" = "Cohabitating") %>%
fct_relevel(
c("Currently Married", "Previously Married",
"Never Married")),
dm = case_when(
ff_hba1c_0 > 6.5 ~ "Yes", c_dm == "Yes" ~ "Yes",
h_antidm == "Yes" ~ "Yes", ff_fbs_0 > 7 ~ "Yes",
TRUE ~ "No"),
hyperlipidemia = case_when(
c_hyperlip == "Yes" ~ "Yes", h_antilipid == "Yes" ~ "Yes",
ff_totchol_0 > 5.17 ~ "Yes", TRUE ~ "No"),
#---
active_wh2 = as.character(g_active_wh),
active_wh2 = case_when(active_wh2 == "" ~ "0", TRUE ~ active_wh2),
active_wh2 = str_extract(active_wh2, "\\d+") %>% parse_number(),
active_wm2 = as.character(g_active_wm),
active_wm2 = case_when(active_wm2 == "" ~ "0", TRUE ~ active_wm2),
active_wm2 = str_extract(active_wm2, "\\d+") %>% parse_number(),
active_work_hrs = case_when(
(g_active_wh == "" & g_active_wm == "") ~ NA,
TRUE ~ active_wm2 + 60*active_wh2)/60,
#---
active_wh2 = as.character(g_active_lei),
active_wh2 = case_when(active_wh2 == "" ~ "0", TRUE ~ active_wh2),
active_wh2 = str_extract(active_wh2, "\\d+") %>% parse_number(),
active_wm2 = as.character(g_active_wm2),
active_wm2 = case_when(active_wm2 == "" ~ "0", TRUE ~ active_wm2),
active_wm2 = str_extract(active_wm2, "\\d+") %>% parse_number(),
active_leisure_hrs = case_when(
(g_active_lei == "" & g_active_wm2 == "") ~ NA,
TRUE ~ active_wm2 + 60*active_wh2)/60,
bmi = ee_wgt_0/(ee_heightcm/100)^2,
waist_hip_ratio = ee_waistc_0/ee_hipc_0,
tobacco_use = case_when(g_tobacco %in% c(
"Formerly used tobacco products",
"Stopped after the stroke occurred",
"Currently uses tobacco products") ~ "Yes",
g_tobacco == "Never used tobacco products" ~ "No"),
egfr = str_extract(ff_egfr_0, "\\d+") %>% as.numeric(),
egfr_cat = case_when(
egfr < 60 ~ "<60",
egfr >= 60 & egfr <= 89~ "60 to 89",
egfr > 89 ~ ">89"
) %>% factor(levels = c("<60", "60 to 89", ">89")),
ranking = str_extract(x_ranking, "\\d+") %>% as.numeric(),
barthels_feed = ifelse(y_feeding == "O= unable", "0", as.character(y_feeding)) %>%
str_extract("^\\d+") %>%
as.numeric(),
barthels_bathing = str_extract(y_bathing, "^\\d+") %>% as.numeric(),
barthels_grooming = str_extract(y_grooming, "^\\d+") %>% as.numeric(),
barthels_dressing = str_extract(y_dressing, "^\\d+") %>% as.numeric(),
barthels_bowels = str_extract(y_bowels, "^\\d+") %>% as.numeric(),
barthels_bladder = str_extract(y_bladder, "^\\d+") %>% as.numeric(),
barthels_toilet = str_extract(y_toilet, "^\\d+") %>% as.numeric(),
barthels_bedtochair = str_extract(y_bedtochair, "^\\d+") %>% as.numeric(),
barthels_mobility = str_extract(y_mobility, "^\\d+") %>% as.numeric(),
barthels_stairs = str_extract(y_stairs, "^\\d+") %>% as.numeric(),
barthels_index = barthels_bathing + barthels_grooming + barthels_dressing +
barthels_bowels + barthels_bladder + barthels_toilet +
barthels_bedtochair + barthels_mobility + barthels_stairs,
nihss_levcon = str_extract(z_levcon, "^\\d+") %>% as.numeric(),
nihss_loc_quest = str_extract(z_loc_quest, "^\\d+") %>% as.numeric(),
nihss_loc_comm = str_extract(z_loc_comm, "^\\d+") %>% as.numeric(),
nihss_bestgaze = str_extract(z_bestgaze, "^\\d+") %>% as.numeric(),
nihss_vfield = str_extract(z_vfield, "^\\d+") %>% as.numeric(),
nihss_facparesis = str_extract(z_facparesis, "^\\d+") %>% as.numeric(),
nihss_motor_armr = str_extract(z_motor_armr, "^\\d+") %>% as.numeric(),
nihss_motor_arml = str_extract(z_motor_arml, "^\\d+") %>% as.numeric(),
nihss_motor_legr = str_extract(z_motor_legr, "^\\d+") %>% as.numeric(),
nihss_motor_legl = str_extract(z_motor_legl, "^\\d+") %>% as.numeric(),
nihss_limbataxia = str_extract(z_limbataxia, "^\\d+") %>% as.numeric(),
nihss_pinprick = str_extract(z_pinprick, "^\\d+") %>% as.numeric(),
nihss_bestlang = str_extract(z_bestlang, "^\\d+") %>% as.numeric(),
nihss_dysarthria = str_extract(z_dysarthria, "^\\d+") %>% as.numeric(),
nihss_extinction = str_extract(z_extinction, "^\\d+") %>% as.numeric(),
nihss_scale = nihss_levcon + nihss_loc_quest + nihss_loc_comm +
nihss_bestgaze + nihss_vfield + nihss_facparesis + nihss_motor_armr +
nihss_motor_arml + nihss_motor_legr + nihss_motor_legl +
nihss_limbataxia + nihss_pinprick + nihss_bestlang +
nihss_dysarthria + nihss_extinction,
mobility = case_when(
str_detect(p_mobility , "
I have no problems in walking about") ~ "1",
str_detect(p_mobility ,
"I have some problems in walking about") ~ "2",
str_detect(p_mobility , "I am confined to bed") ~ "3")%>%
as.numeric(),
selfcare = case_when(
str_detect(p_selfcare , "I have no problems with self-care") ~ "1",
str_detect(p_selfcare , "I have some problems with washing or") ~ "2",
str_detect(p_selfcare , "I am unable to wash or dress myself") ~ "3")%>%
as.numeric(),
usual_act = case_when(
str_detect(p_usual_act , "I have no problems with performing my") ~ "1",
str_detect(p_usual_act , "I have some problems with performing") ~ "2",
str_detect(p_usual_act , "I am unable to perform my usual activitie") ~ "3")%>%
as.numeric(),
pain_disc = case_when(
str_detect(p_pain_disc , "I have no pain or discomfort") ~ "1",
str_detect(p_pain_disc , "I have moderate pain or discomfort") ~ "2",
str_detect(p_pain_disc , "I have extreme pain or discomfort") ~ "3") %>%
as.numeric(),
anxiety = case_when(
str_detect(p_anxiety, "I am not anxious or depressed") ~ "1",
str_detect(p_anxiety, "I am moderately anxious or depressed") ~ "2",
str_detect(p_anxiety, "I am extremely anxious or depressed") ~ "3")%>%
as.numeric(),
eq_5d = mobility + selfcare + usual_act + pain_disc + anxiety,
vas = p_health,
vas_cat = ifelse(vas < median(vas, na.rm=TRUE), "Below Median", "Median & above"),
aa_bp_115_75_corrrect = ifelse(aa_bp_115_75 == "Normal", "Yes", "No"),
aa_bp160_100_correct = ifelse(aa_bp160_100 == "High", "Yes", "No"),
aa_hptlasts_correct = ifelse(aa_hptlasts == "The Rest of their Life", "Yes", "No"),
aa_hptmeds_correct = ifelse(aa_hptmeds == "Everyday", "Yes", "No"),
aa_losewght_correct = ifelse(aa_losewght == "Go Down", "Yes", "No"),
aa_eatsalt_correct = ifelse(aa_eatsalt == "Go Down", "Yes", "No"),
aa_hrtattack_correct = ifelse(aa_hrtattack == "Yes", "Yes", "No"),
aa_cancer_correct = ifelse(aa_cancer == "No", "Yes", "No"),
aa_stroke_correct = ifelse(aa_stroke == "Yes", "Yes", "No"),
aa_kidneyp_correct = ifelse(aa_kidneyp == "Yes", "Yes", "No"),
aa_highrisk_correct = ifelse(aa_highrisk == "Yes", "Yes", "No"),
aa_headache_correct = ifelse(aa_headache == "No", "Yes", "No"),
aa_feelgood_correct = ifelse(aa_feelgood == "Never", "Yes", "No"),
aa_strokeris_correct = ifelse(
aa_strokeris == "The Rest of Their Life", "Yes", "No"),
aa_hkq = (aa_bp_115_75_corrrect == "Yes") + (aa_bp160_100_correct == "Yes") +
(aa_hptlasts_correct =="Yes") + (aa_hptmeds_correct == "Yes") +
(aa_losewght_correct == "Yes") + (aa_eatsalt_correct == "Yes") +
(aa_hrtattack_correct == "Yes") + (aa_cancer_correct == "Yes") +
(aa_stroke_correct == "Yes") + (aa_kidneyp_correct == "Yes") +
(aa_highrisk_correct == "Yes") + (aa_headache_correct =="Yes") +
(aa_feelgood_correct =="Yes") + (aa_strokeris_correct == "Yes"),
aa_hkq_cat = ifelse(
aa_hkq <= median(aa_hkq, na.rm=T), "Median & below", "Above Median"
) %>% factor(levels = c("Median & below", "Above Median")),
male = case_when(a_gender == "Male" ~ "Yes", a_gender == "Female" ~ "No"),
active_leisure_hrs = ifelse(
active_leisure_hrs > 16,
median(active_leisure_hrs, na.rm=TRUE), active_leisure_hrs),
active_work_hrs = ifelse(
active_work_hrs > 16,
median(active_work_hrs, na.rm=TRUE), active_work_hrs),
bmi = ifelse(bmi >70, median(bmi, na.rm = TRUE), bmi),
ee_dbp_0 = ifelse(ee_dbp_0 <1, ee_dbp_0*100, ee_dbp_0),
ee_waistc_0 =ifelse(
ee_waistc_0 < 10, median(ee_waistc_0, na.rm=TRUE), ee_waistc_0),
ff_creat_0 = ifelse(ff_creat_0 < 5, ff_creat_0*10, ff_creat_0),
hosp_cat = case_when(
datagrp %in% c("CCTH SITE", "KATH SITE", "KORLE-BU SITE") ~ "Tertiary",
datagrp %in% c(
"KUMASI SOUTH HOSPITAL", "AGOGO SITE", "KNUST SITE") ~ "Secondary",
datagrp %in% c(
"ANKAASE SITE", "MANHYIA GOVT HOSPITAL", "KWADASO SITE", "TAFO SITE") ~ "Primary"
),
across(
c(s_g10worth, s_g11help, s_g12depress, s_g13hope, s_h2control,
s_h3ability, s_h4things, s_h5overcome),
.fns = ~fct_na_level_to_value(.x, "Refused")),
across(
c(s_g10worth, s_g11help, s_g12depress, s_g13hope, s_h2control,
s_h3ability, s_h4things, s_h5overcome),
.fns = ~factor(.x),
.names = "{.col}_unclassed"),
across(
c(s_g10worth_unclassed, s_g11help_unclassed, s_g12depress_unclassed,
s_g13hope_unclassed, s_h2control_unclassed, s_h3ability_unclassed,
s_h4things_unclassed, s_h5overcome_unclassed),
.fns = ~unclass(.x)),
s_h3ability_unclassed = 6 - s_h3ability_unclassed,
s_h4things_unclassed = 6 - s_h4things_unclassed,
across(
c(s_g10worth_unclassed, s_g11help_unclassed, s_g12depress_unclassed,
s_g13hope_unclassed, s_h2control_unclassed, s_h3ability_unclassed,
s_h4things_unclassed, s_h5overcome_unclassed),
.fns = ~.x-3),
perceived_stress = s_g10worth_unclassed + s_g11help_unclassed +
s_g12depress_unclassed + s_g13hope_unclassed + s_h2control_unclassed +
s_h3ability_unclassed + s_h4things_unclassed + s_h5overcome_unclassed,
perceived_stress_cat = ifelse(
perceived_stress <= median(perceived_stress, na.rm=TRUE), "Low", "High") %>%
factor(levels = c("Low", "High")),
hamd_cat = case_when(
r_hamd_total <= 8 ~ "Normal",
r_hamd_total < 14 ~ "Mild Depression",
r_hamd_total < 19 ~ "Moderate Depression",
r_hamd_total < 23 ~ "Severe Depression",
r_hamd_total >= 23 ~ "Very Severe Depression"
) %>%
factor(
levels = c(
"Normal", "Mild Depression", "Moderate Depression",
"Severe Depression", "Very Severe Depression"),
ordered = TRUE),
across(
c(l_forget, l_decide, l_salty, l_shake, l_fasfood, l_appoint,
l_missched, l_prescrip, l_runout, l_skipmed, l_feelbet,
l_feelsick, l_someone, l_careless),
.fns = ~factor(.x),
.names = "{.col}_unclassed"),
across(
c(l_forget_unclassed, l_decide_unclassed, l_salty_unclassed,
l_shake_unclassed, l_fasfood_unclassed, l_appoint_unclassed,
l_missched_unclassed, l_prescrip_unclassed, l_runout_unclassed,
l_skipmed_unclassed, l_feelbet_unclassed, l_feelsick_unclassed,
l_someone_unclassed, l_careless_unclassed),
.fns = ~unclass(.x)),
hillbone = (l_forget_unclassed + l_decide_unclassed +
l_salty_unclassed + l_shake_unclassed +
l_fasfood_unclassed + l_appoint_unclassed +
l_missched_unclassed + l_prescrip_unclassed +
l_runout_unclassed + l_skipmed_unclassed +
l_feelbet_unclassed + l_feelsick_unclassed +
l_someone_unclassed + l_careless_unclassed) %>%
as.numeric(),
hillbone_cat = ifelse(
hillbone >= median(hillbone, na.rm=TRUE), "High", "Low"),
hamd_cat_2 = fct_recode(
hamd_cat,
Moderate_Severe = "Moderate Depression",
Moderate_Severe = "Severe Depression",
Moderate_Severe = "Very Severe Depression"
) %>% factor(ordered = F),
a_poccup3 = a_poccup2 %>%
fct_recode(
Skilled = "Highly Skilled academic professional",
Skilled = "Skilled Worker",
Skilled = "Semi-Skilled Worker",
Manual = "Manual Worker",
Unemployed = "Home maker",
Unemployed = "Unemployed( Unable to work)",
Unemployed = "Unemployed ( able to work)",
Retired = "Retired",
Others = "Non-paid Worker",
Others = "Home maker"
) %>% fct_na_level_to_value("Student"),
morisky_4_score = (unclass(k_forget) + unclass(k_miss) +
unclass(k_fine) + unclass(k_doctor)),
morisky_4_raw = factor(morisky_4_score, ordered = TRUE),
morisky_4_cat = case_when(
morisky_4_score < 8 ~ "Low",
morisky_4_score == 8 ~ "High"
),
across(
c(o_headache, o_dizziness, o_thirst, o_edema, o_coldhands,
o_flush, o_fatigue, o_cough, o_palpitat, o_nausea,
o_constipat, o_drowsy, o_insomnia, o_dreams, o_frequent,
o_darker, o_depression, o_anxiety, o_libido, o_impotence),
.fns = ~(.x == "Checked"),
.names = "{.col}_new"),
side_effects = o_headache_new + o_dizziness_new + o_thirst_new +
o_edema_new + o_coldhands_new + o_flush_new + o_fatigue_new +
o_cough_new + o_palpitat_new + o_nausea_new +
o_constipat_new + o_drowsy_new + o_insomnia_new +
o_dreams_new + o_frequent_new + o_darker_new +
o_depression_new + o_anxiety_new + o_libido_new +
o_impotence_new,
mrs_cat = case_when(
ranking <= 2 ~ "0 to 2",
ranking > 2 ~ "3-6"),
barthel_cat = case_when(
barthels_index < 90 ~ "< 90",
barthels_index >= 90 ~ ">= 90"))Warning: There were 8 warnings in `mutate()`.
The first warning was:
ℹ In argument: `egfr0 = parse_number(ff_egfr_0)`.
Caused by warning:
! 2 parsing failures.
row col expected actual
1276 -- a number N/A
1336 -- a number N/A
ℹ Run `dplyr::last_dplyr_warnings()` to see the 7 remaining warnings.
df_pings2_bp <-
df_pings2_bp %>%
labelled::set_variable_labels(
female = "Gender, female",
d_st_type = "Type of Stroke",
nihss_scale ="Stroke Severity (NIHSS)",
ranking = "Modified Ranking Score",
dm = "Diabetes Mellitus",
sbp = "Systolic Blood Pressure",
dbp = "Diastolic Blood Pressure",
hpt = "Hypertesion",
hyperlipidemia = "Hyperlipidemia",
tobacco_use = "Cigarette smoking",
obese_overwgt = "Overweight & obesity",
alcohol_curr = "Alcohol use, current",
alcohol_ever = "Alcohol use, ever",
acei = "ACE-Inhibitors",
arb = "ARB",
bb = "B-blockers",
ccb = "Calcium channel blocker",
diuretics = "Diuretics",
female = "Gender, female",
income2 = "Income level",
educ2 = "Educational Level",
agecat = "Age in years",
h_alpha_md = "Alpha Methyl Dopa",
h_alpha_ab = "Alpha Adrenergic Blockers",
h_antiplt = "Antiplatelets",
h_statins = "Statins",
morisky_4_item = "Morisky (4 Items)",
hillbone = "Total Hillbone Score",
aa_hkq = "Health Literacy in HPT/stroke",
eq_5d = "Health Related QoL",
p_health = "Health Related QoL",
hpt_self_care = "Hypertension Self Care",
sbp_less_140_itt = "SBP < 140 mmHg at month 12 (ITT)",
sbp_less_140_pp = "SBP < 140 mmHg at month 12 (PP)",
bp_less_140_90_itt = "BP < 140/90 mmHg at month 12 (ITT)",
bp_less_140_90_pp = "BP < 140/90 mmHg at month 12 (PP)",
sbp_diff = "Change in SBP(month 12 from baseline - PP)",
dbp_diff = "Change in DBP(month 12 from baseline - PP)",
sbp_less_130_itt = "SBP < 130 mmHg at month 12 (ITT)",
sbp_less_130_pp = "SBP < 130 mmHg at month 12 (PP)",
sbp_less_135_itt = "SBP < 135 mmHg at month 12 (ITT)",
sbp_less_135_pp = "SBP < 135 mmHg at month 12 (PP)",
max_review = "Follow-up period",
review_no = "Review number",
completed_study = "Completed Study",
sbp_2 = "Systolic Blood Pressure (ITT)",
dbp_2 = "Systolic Blood Pressure (ITT)",
sbp_baseline = "Systolic Blood Pressure (Baseline)",
dbp_baseline = "Diastolic Blood Pressure (Baseline)",
sbp_diff_itt ="Change in SBP(month 12 from baseline)- ITT",
dbp_diff_itt = "Change in DBP(month 12 from baseline) - ITT",
educ = "Educational Status",
a_livingsit2 = "Living Status",
income = "Income in GHC",
maristat = "Marital Status",
dm = "Diabetes Mellitus",
hyperlipidemia = "Hyperlipidemia",
active_leisure_hrs = "Hours active during leisure",
active_work_hrs = "Hours active during work",
bmi = "Body Mass Index",
waist_hip_ratio = "Waist-Hip Ratio",
tobacco_use = "History of tobacco use",
# who_risk_cat_2 = "WHO Risk Category",
egfr_cat = "eGFR",
ranking = "Modified Ranking Score",
barthels_index = "Barthels Index",
nihss_scale = "NIH Stroke Scale",
mobility = "Mobility",
selfcare = "Self Care",
usual_act = "Usual Activity",
pain_disc = "Pain Discomfort",
anxiety = "Anxiety",
aa_bp_115_75_corrrect =
"If someones blood pressure is 115/75. it is",
aa_bp160_100_correct =
"If someones blood pressure is 160/100. It is",
aa_hptlasts_correct =
"Once someone has high blood pressure, it usually lasts for",
aa_hptmeds_correct =
"People with high blood pressure should take their medicine",
aa_losewght_correct =
"Losing weight usually makes blood pressure",
aa_eatsalt_correct = "Eating less salt usually makes blood pressure",
aa_hrtattack_correct = "High blood pressure can cause heart attacks",
aa_cancer_correct = "High blood pressure can cause cancer",
aa_kidneyp_correct =
"High blood pressure can cause can kidney problems",
aa_stroke_correct = "High blood pressure can cause strokes",
aa_highrisk_correct =
"Someone who has had a stroke is at higher risk of having another",
aa_headache_correct =
"If someone is not having headaches they can stop taking medications",
aa_feelgood_correct =
"If someone is feeling good it is ok to miss doses of medication",
aa_strokeris_correct =
"Once someone has had a stroke, they will be at risk for stroke for",
aa_hkq = "Total HKQ Score",
aa_hkq_cat = "Categorised Total HKQ Score",
male = "Male sex",
ee_dbp_0 = "Diastolic Blood Pressure",
ee_waistc_0 = "Waist circumference (cm)",
ff_creat_0 = "Serum Creatinine (mmol/L)",
hosp_cat = "Health institution category",
vas_cat = "Categorised VAS",
hamd_cat = "Depression (HAMD)",
hamd_cat_2 = "Depression (HAMD)",
hillbone = "Total Hillbone Score",
hillbone_cat = "Categorised Hillbone Score",
morisky_4_cat = "Morisky 4 Items Categorised",
o_headache_new = "Headache",
o_dizziness_new ="Dizziness",
o_thirst_new = "Thirst/ dry mouth",
o_edema_new = "Edema",
o_coldhands_new = "Cold hands or feet",
o_flush_new = "Flush",
o_fatigue_new = "Fatigue",
o_cough_new = "Cough",
o_palpitat_new = "Palpitations",
o_nausea_new = "Nausea/ indigestion/ vomiting",
o_constipat_new = "Change in bowel habit",
o_drowsy_new = "Drowsiness",
o_insomnia_new = "Insomnia",
o_dreams_new = "Dreams/Nightmares",
o_frequent_new = "Frequency of micturition",
o_darker_new = "Dark Urine/Oliguria",
o_depression_new = "Depression",
o_anxiety_new = "Anxiety",
o_libido_new = "Decreased libido",
o_impotence_new = "Erectile Dysfunction",
g_alcohol = "Alcohol use",
side_effects = "No. of Side Effects")gtsummary::reset_gtsummary_theme()
gtsummary::theme_gtsummary_compact()Setting theme "Compact"
df_pings2_bp %>%
filter(eventname == "Baseline") %>%
select(
mrs_cat, a_agebase, a_gender, a_domicile, educ, a_poccup3,
maristat, income, hosp_cat, d_st_type, d_stroke_ct, d_stroke_loc,
nihss_scale, bmi, obese_overwgt, tobacco_use, alcohol_ever, dm,
c_hyperlip, c_afib,
barthels_index, barthel_cat) %>%
gtsummary::tbl_summary(
by = mrs_cat,
digits = gtsummary::all_categorical()~ c(0,1),
statistic = gtsummary::all_categorical() ~ "{n} ({p})",
missing_text = "Missing") %>%
gtsummary::bold_labels() %>%
gtsummary::modify_caption(
"**Table 1A**: Sociodemographic and clinical characteristics") %>%
gtsummary::modify_spanning_header(
gtsummary::all_stat_cols() ~ "**Modified Ranking Score**") %>%
gtsummary::add_overall()3 missing rows in the "mrs_cat" column have been removed.
| Characteristic | Overall N = 4971 |
Modified Ranking Score
|
|
|---|---|---|---|
| 0 to 2 N = 2961 |
3-6 N = 2011 |
||
| Age in years | 58 (51, 67) | 57 (50, 65) | 61 (53, 70) |
| Gender | |||
| Male | 281 (56.5) | 168 (56.8) | 113 (56.2) |
| Female | 216 (43.5) | 128 (43.2) | 88 (43.8) |
| Domicile | |||
| Rural | 33 (6.6) | 22 (7.4) | 11 (5.5) |
| Semi-Urban | 166 (33.4) | 98 (33.1) | 68 (33.8) |
| Urban | 298 (60.0) | 176 (59.5) | 122 (60.7) |
| Educational Status | |||
| None | 48 (9.7) | 28 (9.5) | 20 (10.0) |
| Primary | 202 (40.6) | 114 (38.5) | 88 (43.8) |
| Secondary | 164 (33.0) | 100 (33.8) | 64 (31.8) |
| Tertiary | 83 (16.7) | 54 (18.2) | 29 (14.4) |
| Primary Occupation | |||
| Skilled | 237 (47.7) | 153 (51.7) | 84 (41.8) |
| Manual | 107 (21.5) | 70 (23.6) | 37 (18.4) |
| Others | 20 (4.0) | 13 (4.4) | 7 (3.5) |
| Retired | 57 (11.5) | 30 (10.1) | 27 (13.4) |
| Unemployed | 76 (15.3) | 30 (10.1) | 46 (22.9) |
| Marital Status | |||
| Currently Married | 332 (66.8) | 197 (66.6) | 135 (67.2) |
| Previously Married | 142 (28.6) | 83 (28.0) | 59 (29.4) |
| Never Married | 23 (4.6) | 16 (5.4) | 7 (3.5) |
| Income in GHC | |||
| 0-100 | 174 (35.2) | 88 (30.0) | 86 (42.8) |
| 101-250 | 150 (30.4) | 92 (31.4) | 58 (28.9) |
| 251-500 | 108 (21.9) | 65 (22.2) | 43 (21.4) |
| >500 | 62 (12.6) | 48 (16.4) | 14 (7.0) |
| Missing | 3 | 3 | 0 |
| Health institution category | |||
| Primary | 148 (29.8) | 80 (27.0) | 68 (33.8) |
| Secondary | 116 (23.3) | 68 (23.0) | 48 (23.9) |
| Tertiary | 233 (46.9) | 148 (50.0) | 85 (42.3) |
| Type of Stroke | |||
| Ischemic Stroke | 329 (73.6) | 187 (70.0) | 142 (78.9) |
| Intracerebral Hemorrhagic Stroke | 103 (23.0) | 75 (28.1) | 28 (15.6) |
| Ischemic With Hemorrhagic Transformation | 10 (2.2) | 4 (1.5) | 6 (3.3) |
| Untyped Stroke (no CT scan available) | 5 (1.1) | 1 (0.4) | 4 (2.2) |
| Missing | 50 | 29 | 21 |
| Stroke Subtype ( with results of Brain CT scan) | |||
| Ischaemic | 310 (73.5) | 174 (69.0) | 136 (80.0) |
| Haemorrhage infarct | 16 (3.8) | 8 (3.2) | 8 (4.7) |
| Haemorrhagic | 84 (19.9) | 64 (25.4) | 20 (11.8) |
| Ischaemic and Haemorrhagic | 12 (2.8) | 6 (2.4) | 6 (3.5) |
| Missing | 75 | 44 | 31 |
| Stroke Location | |||
| Anterior Circulation | 279 (75.2) | 170 (76.6) | 109 (73.2) |
| Posterior Circulation | 92 (24.8) | 52 (23.4) | 40 (26.8) |
| Missing | 126 | 74 | 52 |
| Stroke Severity (NIHSS) | 3.0 (0.0, 8.0) | 0.0 (0.0, 3.0) | 7.0 (4.0, 12.0) |
| Missing | 10 | 6 | 4 |
| Body Mass Index | 26.2 (22.7, 30.0) | 26.7 (23.2, 30.5) | 25.4 (22.2, 28.4) |
| Missing | 18 | 6 | 12 |
| Overweight & obesity | 258 (59.9) | 167 (65.0) | 91 (52.3) |
| Missing | 66 | 39 | 27 |
| Cigarette smoking | 45 (9.3) | 21 (7.4) | 24 (12.1) |
| Missing | 13 | 11 | 2 |
| Alcohol use, ever | 204 (41.1) | 126 (42.7) | 78 (38.8) |
| Missing | 1 | 1 | 0 |
| Diabetes Mellitus | 166 (33.4) | 93 (31.4) | 73 (36.3) |
| Hyperlipidemia | |||
| Yes | 40 (8.1) | 23 (7.8) | 17 (8.5) |
| No | 435 (87.7) | 261 (88.5) | 174 (86.6) |
| Dont Know | 21 (4.2) | 11 (3.7) | 10 (5.0) |
| Missing | 1 | 1 | 0 |
| Atrial Fibrillation | |||
| Yes | 1 (0.2) | 1 (0.3) | 0 (0.0) |
| No | 473 (95.4) | 279 (94.6) | 194 (96.5) |
| Dont Know | 22 (4.4) | 15 (5.1) | 7 (3.5) |
| Missing | 1 | 1 | 0 |
| Barthels Index | 80 (40, 90) | 90 (80, 90) | 40 (25, 65) |
| Missing | 13 | 9 | 4 |
| barthel_cat | |||
| < 90 | 284 (58.7) | 98 (34.1) | 186 (94.4) |
| >= 90 | 200 (41.3) | 189 (65.9) | 11 (5.6) |
| Missing | 13 | 9 | 4 |
| 1 Median (Q1, Q3); n (%) | |||
df_pings2_bp %>% #select(barthel_index) %>% dlookr::describe()
filter(eventname == "Baseline") %>%
select(
mrs_cat, a_agebase, a_gender, a_domicile, educ, a_poccup3,
maristat, income, hosp_cat, d_st_type, d_stroke_ct, d_stroke_loc,
nihss_scale, bmi, obese_overwgt, tobacco_use, alcohol_ever, dm,
c_hyperlip, c_afib, barthel_cat) %>%
gtsummary::tbl_summary(
by = barthel_cat,
digits = gtsummary::all_categorical()~ c(0,1),
statistic = gtsummary::all_categorical() ~ "{n} ({p})",
missing_text = "Missing") %>%
gtsummary::bold_labels() %>%
gtsummary::modify_caption(
"**Table 1B**: Sociodemographic and clinical characteristics") %>%
gtsummary::modify_spanning_header(
gtsummary::all_stat_cols() ~ "**Barthel's Index**") %>%
gtsummary::add_overall()16 missing rows in the "barthel_cat" column have been removed.
| Characteristic | Overall N = 4841 |
Barthel’s Index
|
|
|---|---|---|---|
| < 90 N = 2841 |
>= 90 N = 2001 |
||
| mrs_cat | |||
| 0 to 2 | 287 (59.3) | 98 (34.5) | 189 (94.5) |
| 3-6 | 197 (40.7) | 186 (65.5) | 11 (5.5) |
| Age in years | 58 (51, 67) | 60 (53, 69) | 57 (48, 65) |
| Gender | |||
| Male | 270 (55.8) | 159 (56.0) | 111 (55.5) |
| Female | 214 (44.2) | 125 (44.0) | 89 (44.5) |
| Domicile | |||
| Rural | 33 (6.8) | 24 (8.5) | 9 (4.5) |
| Semi-Urban | 162 (33.5) | 89 (31.3) | 73 (36.5) |
| Urban | 289 (59.7) | 171 (60.2) | 118 (59.0) |
| Educational Status | |||
| None | 48 (9.9) | 30 (10.6) | 18 (9.0) |
| Primary | 199 (41.1) | 124 (43.7) | 75 (37.5) |
| Secondary | 158 (32.6) | 87 (30.6) | 71 (35.5) |
| Tertiary | 79 (16.3) | 43 (15.1) | 36 (18.0) |
| Primary Occupation | |||
| Skilled | 230 (47.5) | 122 (43.0) | 108 (54.0) |
| Manual | 104 (21.5) | 60 (21.1) | 44 (22.0) |
| Others | 19 (3.9) | 14 (4.9) | 5 (2.5) |
| Retired | 56 (11.6) | 33 (11.6) | 23 (11.5) |
| Unemployed | 75 (15.5) | 55 (19.4) | 20 (10.0) |
| Marital Status | |||
| Currently Married | 324 (66.9) | 190 (66.9) | 134 (67.0) |
| Previously Married | 138 (28.5) | 80 (28.2) | 58 (29.0) |
| Never Married | 22 (4.5) | 14 (4.9) | 8 (4.0) |
| Income in GHC | |||
| 0-100 | 171 (35.6) | 131 (46.1) | 40 (20.3) |
| 101-250 | 147 (30.6) | 72 (25.4) | 75 (38.1) |
| 251-500 | 106 (22.0) | 52 (18.3) | 54 (27.4) |
| >500 | 57 (11.9) | 29 (10.2) | 28 (14.2) |
| Missing | 3 | 0 | 3 |
| Health institution category | |||
| Primary | 146 (30.2) | 108 (38.0) | 38 (19.0) |
| Secondary | 110 (22.7) | 74 (26.1) | 36 (18.0) |
| Tertiary | 228 (47.1) | 102 (35.9) | 126 (63.0) |
| Type of Stroke | |||
| Ischemic Stroke | 320 (73.7) | 199 (77.7) | 121 (68.0) |
| Intracerebral Hemorrhagic Stroke | 99 (22.8) | 44 (17.2) | 55 (30.9) |
| Ischemic With Hemorrhagic Transformation | 10 (2.3) | 8 (3.1) | 2 (1.1) |
| Untyped Stroke (no CT scan available) | 5 (1.2) | 5 (2.0) | 0 (0.0) |
| Missing | 50 | 28 | 22 |
| Stroke Subtype ( with results of Brain CT scan) | |||
| Ischaemic | 302 (73.5) | 190 (78.5) | 112 (66.3) |
| Haemorrhage infarct | 16 (3.9) | 12 (5.0) | 4 (2.4) |
| Haemorrhagic | 82 (20.0) | 32 (13.2) | 50 (29.6) |
| Ischaemic and Haemorrhagic | 11 (2.7) | 8 (3.3) | 3 (1.8) |
| Missing | 73 | 42 | 31 |
| Stroke Location | |||
| Anterior Circulation | 272 (75.6) | 160 (74.1) | 112 (77.8) |
| Posterior Circulation | 88 (24.4) | 56 (25.9) | 32 (22.2) |
| Missing | 124 | 68 | 56 |
| Stroke Severity (NIHSS) | 3.0 (0.0, 8.0) | 6.0 (3.0, 10.0) | 0.0 (0.0, 1.0) |
| Missing | 8 | 7 | 1 |
| Body Mass Index | 26.2 (22.7, 30.0) | 25.9 (22.5, 29.3) | 26.4 (23.3, 30.7) |
| Missing | 18 | 12 | 6 |
| Overweight & obesity | 250 (59.7) | 146 (56.6) | 104 (64.6) |
| Missing | 65 | 26 | 39 |
| Cigarette smoking | 42 (8.9) | 28 (10.1) | 14 (7.2) |
| Missing | 12 | 6 | 6 |
| Alcohol use, ever | 198 (41.0) | 109 (38.4) | 89 (44.7) |
| Missing | 1 | 0 | 1 |
| Diabetes Mellitus | 160 (33.1) | 96 (33.8) | 64 (32.0) |
| Hyperlipidemia | |||
| Yes | 38 (7.9) | 20 (7.0) | 18 (9.0) |
| No | 425 (88.0) | 250 (88.0) | 175 (87.9) |
| Dont Know | 20 (4.1) | 14 (4.9) | 6 (3.0) |
| Missing | 1 | 0 | 1 |
| Atrial Fibrillation | |||
| Yes | 1 (0.2) | 1 (0.4) | 0 (0.0) |
| No | 461 (95.4) | 273 (96.1) | 188 (94.5) |
| Dont Know | 21 (4.3) | 10 (3.5) | 11 (5.5) |
| Missing | 1 | 0 | 1 |
| 1 n (%); Median (Q1, Q3) | |||
df_pings2_bp %>%
select(mrs_cat, barthel_cat, eventname) %>%
gtsummary::tbl_summary(by = eventname) %>%
gtsummary::bold_labels()| Characteristic | Baseline N = 5001 |
Month 1 N = 5001 |
Month 3 N = 5001 |
Month 6 N = 5001 |
Month 9 N = 5001 |
Month12 N = 5001 |
|---|---|---|---|---|---|---|
| mrs_cat | ||||||
| 0 to 2 | 296 (60%) | 309 (65%) | 306 (69%) | 317 (74%) | 323 (76%) | 342 (79%) |
| 3-6 | 201 (40%) | 169 (35%) | 138 (31%) | 111 (26%) | 102 (24%) | 92 (21%) |
| Unknown | 3 | 22 | 56 | 72 | 75 | 66 |
| barthel_cat | ||||||
| < 90 | 284 (59%) | 215 (47%) | 184 (43%) | 162 (39%) | 147 (36%) | 142 (34%) |
| >= 90 | 200 (41%) | 246 (53%) | 247 (57%) | 251 (61%) | 256 (64%) | 279 (66%) |
| Unknown | 16 | 39 | 69 | 87 | 97 | 79 |
| 1 n (%) | ||||||
# df_pings2_bp %>%
# filter(eventname == "Baseline") %>%
# mutate(arm = factor(arm)) %>%
# glm(arm ~ a_agebase + a_domicile, family=binomial(), data = .) %>%
# gtsummary::tbl_regression(exponentiate = T)
#
# df_pings2_bp %>%
# filter(eventname == "Baseline") %>%
# mutate(arm = factor(arm)) %>%
# glm(arm ~ a_agebase * a_domicile, family=binomial(), data = .) %>%
# gtsummary::tbl_regression(exponentiate = T)
#
# df_pings2_bp %>%
# filter(eventname == "Baseline") %>%
# mutate(arm = factor(arm)) %>%
# fastDummies::dummy_cols(
# select_columns = "a_domicile",
# remove_selected_columns = F,
# remove_first_dummy = TRUE) %>%
# glm(arm ~ a_agebase*`a_domicile_Semi-Urban` + a_agebase*a_domicile_Urban,
# family=binomial(), data = .) %>%
# gtsummary::tbl_regression(
# exponentiate = T)
df_for_table_2 <-
df_pings2_bp %>%
mutate(
timep = case_when(
eventname == "Baseline" ~ 0,
eventname == "Month 1" ~ 1,
eventname == "Month 3" ~ 3,
eventname == "Month 6" ~ 6,
eventname == "Month 9" ~ 9,
eventname == "Month12" ~ 12)) %>%
select(
a_gender, timep, pid, ranking, a_domicile, a_agebase,
a_agebase, a_gender, a_domicile, educ, a_poccup3,
maristat, income2, hosp_cat, d_st_type, d_stroke_ct,
d_stroke_loc, nihss_scale, bmi, tobacco_use, g_alcohol,
dm, c_hyperlip, c_afib) %>%
arrange(pid, timep) %>%
group_by(pid) %>%
fill(
a_gender, a_domicile, a_agebase, educ, a_poccup3,
maristat, income2, hosp_cat, d_st_type, d_stroke_ct,
d_stroke_loc, bmi, tobacco_use, g_alcohol,
c_hyperlip, c_afib) %>%
ungroup() %>%
mutate(
a_agebase = scale(a_agebase)
)
# Define your list of predictors
predictors <-
c("a_agebase", "a_gender", "a_domicile", "educ", "a_poccup3",
"maristat", "income2", "hosp_cat", "hosp_cat", "d_st_type",
"d_stroke_ct", "d_stroke_loc", "bmi", "tobacco_use", "g_alcohol",
"dm", "c_hyperlip", "c_afib")
# Map over the predictors to create a list of univariate models
univariate_tables <-
predictors %>%
map(
function(var) {
formula_str <-
as.formula(
paste0("ranking ~ timep * ", var, " + (1 | pid)"))
lme4::lmer(formula_str, data = df_for_table_2) %>%
gtsummary::tbl_regression(
label = list(timep = "Time (Baseline Slope)")) %>%
gtsummary::modify_header(
label = paste0("**Predictor: ", str_to_title(var), "**")) %>%
gtsummary::add_global_p()})fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
# Stack them into one table
final_uni_table <-
gtsummary::tbl_stack(univariate_tables) %>%
gtsummary::modify_caption("**Table 1. Univariate Growth Trajectory Interactions**") %>%
gtsummary::bold_p()Column headers among stacked tables differ.
ℹ Use `modify_header()` to update or `quiet = TRUE` to suppress this message.
Table 1 Column Name Header
label "**Predictor: A_agebase**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 2 Column Name Header
label "**Predictor: A_gender**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 3 Column Name Header
label "**Predictor: A_domicile**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 4 Column Name Header
label "**Predictor: Educ**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 5 Column Name Header
label "**Predictor: A_poccup3**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 6 Column Name Header
label "**Predictor: Maristat**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 7 Column Name Header
label "**Predictor: Income2**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 8 Column Name Header
label "**Predictor: Hosp_cat**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 9 Column Name Header
label "**Predictor: Hosp_cat**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 10 Column Name Header
label "**Predictor: D_st_type**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 11 Column Name Header
label "**Predictor: D_stroke_ct**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 12 Column Name Header
label "**Predictor: D_stroke_loc**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 13 Column Name Header
label "**Predictor: Bmi**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 14 Column Name Header
label "**Predictor: Tobacco_use**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 15 Column Name Header
label "**Predictor: G_alcohol**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 16 Column Name Header
label "**Predictor: Dm**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 17 Column Name Header
label "**Predictor: C_hyperlip**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
Table 18 Column Name Header
label "**Predictor: C_afib**"
estimate "**Beta**"
conf.low "**95% CI**"
p.value "**p-value**"
final_uni_table| Predictor: A_agebase | Beta | 95% CI | p-value |
|---|---|---|---|
| Time (Baseline Slope) | -0.05 | -0.05, -0.04 | <0.001 |
| a_agebase | 0.25 | 0.14, 0.35 | <0.001 |
| Time (Baseline Slope) * a_agebase | 0.01 | 0.00, 0.01 | 0.029 |
| Time (Baseline Slope) | -0.05 | -0.06, -0.04 | <0.001 |
| a_gender | 0.2 | ||
| Male | — | — | |
| Female | 0.14 | -0.08, 0.36 | |
| Time (Baseline Slope) * a_gender | 0.030 | ||
| Time (Baseline Slope) * Female | 0.01 | 0.00, 0.02 | |
| Time (Baseline Slope) | -0.04 | -0.06, -0.02 | <0.001 |
| a_domicile | 0.7 | ||
| Rural | — | — | |
| Semi-Urban | 0.21 | -0.25, 0.68 | |
| Urban | 0.16 | -0.29, 0.61 | |
| Time (Baseline Slope) * a_domicile | 0.7 | ||
| Time (Baseline Slope) * Semi-Urban | -0.01 | -0.03, 0.02 | |
| Time (Baseline Slope) * Urban | 0.00 | -0.03, 0.02 | |
| Time (Baseline Slope) | -0.04 | -0.06, -0.02 | <0.001 |
| educ | 0.091 | ||
| None | — | — | |
| Primary | -0.03 | -0.42, 0.36 | |
| Secondary | -0.30 | -0.70, 0.10 | |
| Tertiary | -0.32 | -0.76, 0.12 | |
| Time (Baseline Slope) * educ | 0.2 | ||
| Time (Baseline Slope) * Primary | -0.02 | -0.04, 0.00 | |
| Time (Baseline Slope) * Secondary | 0.00 | -0.03, 0.02 | |
| Time (Baseline Slope) * Tertiary | 0.00 | -0.03, 0.02 | |
| Time (Baseline Slope) | -0.05 | -0.06, -0.04 | <0.001 |
| a_poccup3 | 0.003 | ||
| Skilled | — | — | |
| Manual | -0.14 | -0.42, 0.14 | |
| Others | 0.08 | -0.48, 0.64 | |
| Retired | 0.35 | -0.01, 0.70 | |
| Unemployed | 0.51 | 0.19, 0.82 | |
| Time (Baseline Slope) * a_poccup3 | 0.4 | ||
| Time (Baseline Slope) * Manual | 0.00 | -0.01, 0.02 | |
| Time (Baseline Slope) * Others | -0.02 | -0.06, 0.01 | |
| Time (Baseline Slope) * Retired | 0.01 | -0.01, 0.03 | |
| Time (Baseline Slope) * Unemployed | 0.01 | -0.01, 0.02 | |
| Time (Baseline Slope) | -0.05 | -0.06, -0.04 | <0.001 |
| maristat | 0.7 | ||
| Currently Married | — | — | |
| Previously Married | 0.10 | -0.14, 0.34 | |
| Never Married | -0.07 | -0.59, 0.46 | |
| Time (Baseline Slope) * maristat | 0.065 | ||
| Time (Baseline Slope) * Previously Married | 0.01 | 0.00, 0.03 | |
| Time (Baseline Slope) * Never Married | 0.02 | -0.01, 0.05 | |
| Time (Baseline Slope) | -0.05 | -0.06, -0.04 | <0.001 |
| income2 | <0.001 | ||
| <500 GHc | — | — | |
| >= 500 GHc | -0.68 | -1.0, -0.35 | |
| Time (Baseline Slope) * income2 | 0.080 | ||
| Time (Baseline Slope) * >= 500 GHc | 0.02 | 0.00, 0.03 | |
| Time (Baseline Slope) | -0.04 | -0.05, -0.03 | <0.001 |
| hosp_cat | 0.7 | ||
| Primary | — | — | |
| Secondary | -0.12 | -0.42, 0.18 | |
| Tertiary | 0.00 | -0.26, 0.25 | |
| Time (Baseline Slope) * hosp_cat | 0.010 | ||
| Time (Baseline Slope) * Secondary | 0.01 | -0.01, 0.02 | |
| Time (Baseline Slope) * Tertiary | -0.01 | -0.03, 0.00 | |
| Time (Baseline Slope) | -0.04 | -0.05, -0.03 | <0.001 |
| hosp_cat | 0.7 | ||
| Primary | — | — | |
| Secondary | -0.12 | -0.42, 0.18 | |
| Tertiary | 0.00 | -0.26, 0.25 | |
| Time (Baseline Slope) * hosp_cat | 0.010 | ||
| Time (Baseline Slope) * Secondary | 0.01 | -0.01, 0.02 | |
| Time (Baseline Slope) * Tertiary | -0.01 | -0.03, 0.00 | |
| Time (Baseline Slope) | -0.04 | -0.05, -0.03 | <0.001 |
| d_st_type | 0.007 | ||
| Ischemic Stroke | — | — | |
| Intracerebral Hemorrhagic Stroke | -0.44 | -0.71, -0.17 | |
| Ischemic With Hemorrhagic Transformation | 0.33 | -0.44, 1.1 | |
| Untyped Stroke (no CT scan available) | 0.45 | -0.64, 1.5 | |
| Time (Baseline Slope) * d_st_type | 0.051 | ||
| Time (Baseline Slope) * Intracerebral Hemorrhagic Stroke | -0.01 | -0.03, 0.00 | |
| Time (Baseline Slope) * Ischemic With Hemorrhagic Transformation | 0.00 | -0.05, 0.04 | |
| Time (Baseline Slope) * Untyped Stroke (no CT scan available) | -0.08 | -0.14, -0.01 | |
| Time (Baseline Slope) | -0.04 | -0.05, -0.04 | <0.001 |
| d_stroke_ct | 0.008 | ||
| Ischaemic | — | — | |
| Haemorrhage infarct | 0.06 | -0.56, 0.68 | |
| Haemorrhagic | -0.51 | -0.80, -0.21 | |
| Ischaemic and Haemorrhagic | -0.23 | -0.94, 0.48 | |
| Time (Baseline Slope) * d_stroke_ct | 0.5 | ||
| Time (Baseline Slope) * Haemorrhage infarct | -0.01 | -0.05, 0.02 | |
| Time (Baseline Slope) * Haemorrhagic | -0.01 | -0.03, 0.00 | |
| Time (Baseline Slope) * Ischaemic and Haemorrhagic | 0.00 | -0.04, 0.04 | |
| Time (Baseline Slope) | -0.04 | -0.05, -0.03 | <0.001 |
| d_stroke_loc | >0.9 | ||
| Anterior Circulation | — | — | |
| Posterior Circulation | 0.01 | -0.28, 0.30 | |
| Time (Baseline Slope) * d_stroke_loc | 0.089 | ||
| Time (Baseline Slope) * Posterior Circulation | -0.01 | -0.03, 0.00 | |
| Time (Baseline Slope) | -0.06 | -0.09, -0.03 | <0.001 |
| bmi | -0.03 | -0.05, -0.01 | <0.001 |
| Time (Baseline Slope) * bmi | 0.00 | 0.00, 0.00 | 0.4 |
| Time (Baseline Slope) | -0.04 | -0.05, -0.04 | <0.001 |
| tobacco_use | 0.3 | ||
| No | — | — | |
| Yes | 0.20 | -0.18, 0.58 | |
| Time (Baseline Slope) * tobacco_use | 0.13 | ||
| Time (Baseline Slope) * Yes | -0.02 | -0.04, 0.00 | |
| Time (Baseline Slope) | -0.05 | -0.06, -0.04 | <0.001 |
| g_alcohol | 0.065 | ||
| Never used alcohol | — | — | |
| Currently uses alcohol | -0.26 | -0.62, 0.11 | |
| Past 12 months | -0.75 | -1.5, -0.01 | |
| Past 30 days | -0.78 | -1.7, 0.15 | |
| Formerly used alcohol | -0.29 | -0.57, -0.02 | |
| Stopped after the stroke occured | -0.09 | -0.59, 0.40 | |
| Time (Baseline Slope) * g_alcohol | 0.085 | ||
| Time (Baseline Slope) * Currently uses alcohol | 0.02 | 0.00, 0.03 | |
| Time (Baseline Slope) * Past 12 months | 0.01 | -0.03, 0.04 | |
| Time (Baseline Slope) * Past 30 days | 0.06 | 0.02, 0.11 | |
| Time (Baseline Slope) * Formerly used alcohol | 0.01 | -0.01, 0.02 | |
| Time (Baseline Slope) * Stopped after the stroke occured | 0.01 | -0.02, 0.03 | |
| Time (Baseline Slope) | -0.04 | -0.05, -0.04 | <0.001 |
| dm | 0.10 | ||
| No | — | — | |
| Yes | 0.10 | -0.02, 0.22 | |
| Time (Baseline Slope) | -0.06 | -0.08, -0.04 | <0.001 |
| c_hyperlip | 0.8 | ||
| Yes | — | — | |
| No | 0.04 | -0.36, 0.45 | |
| Dont Know | 0.22 | -0.44, 0.88 | |
| Time (Baseline Slope) * c_hyperlip | 0.5 | ||
| Time (Baseline Slope) * No | 0.01 | -0.01, 0.03 | |
| Time (Baseline Slope) * Dont Know | 0.01 | -0.02, 0.05 | |
| Time (Baseline Slope) | -0.10 | -0.22, 0.03 | 0.12 |
| c_afib | 0.4 | ||
| Yes | — | — | |
| No | -0.03 | -2.5, 2.4 | |
| Dont Know | -0.38 | -2.9, 2.1 | |
| Time (Baseline Slope) * c_afib | 0.7 | ||
| Time (Baseline Slope) * No | 0.05 | -0.07, 0.17 | |
| Time (Baseline Slope) * Dont Know | 0.05 | -0.07, 0.18 | |
| Abbreviation: CI = Confidence Interval | |||
df_for_table_2 <-
df_pings2_bp %>%
mutate(
timep = case_when(
eventname == "Baseline" ~ 0,
eventname == "Month 1" ~ 1,
eventname == "Month 3" ~ 3,
eventname == "Month 6" ~ 6,
eventname == "Month 9" ~ 9,
eventname == "Month12" ~ 12)) %>%
select(
a_gender, timep, pid, ranking, a_domicile, a_agebase,
a_agebase, a_gender, a_domicile, educ, a_poccup3,
maristat, income, hosp_cat, d_st_type, d_stroke_ct,
d_stroke_loc, nihss_scale, bmi, tobacco_use, g_alcohol,
dm, c_hyperlip, c_afib) %>%
arrange(pid, timep) %>%
group_by(pid) %>%
fill(
a_gender, a_domicile, a_agebase, educ, a_poccup3,
maristat, income, hosp_cat, d_st_type, d_stroke_ct,
d_stroke_loc, bmi, tobacco_use, g_alcohol,
c_hyperlip, c_afib) %>%
ungroup()
mv_model <-
lme4::lmer(
ranking ~ timep * (
a_agebase + a_gender) + (1 | pid),
data = df_for_table_2)
mv_table <-
tbl_regression(
mv_model,
label = list(
timep ~ "Time",
a_agebase ~ "Age")) %>%
add_global_p() %>%
bold_labels() %>%
gtsummary::add_glance_table(include = c(nobs, sigma)) %>%
gtsummary::modify_header(label = "**Predictor**") %>%
gtsummary::bold_p(t = 0.05) %>%
gtsummary::italicize_levels()
mv_table| Predictor | Beta | 95% CI | p-value |
|---|---|---|---|
| Time | -0.08 | -0.11, -0.05 | <0.001 |
| Age | 0.02 | 0.01, 0.03 | <0.001 |
| a_gender | 0.4 | ||
| Male | — | — | |
| Female | 0.10 | -0.12, 0.31 | |
| Time * Age | 0.00 | 0.00, 0.00 | 0.041 |
| Time * a_gender | 0.041 | ||
| Time * Female | 0.01 | 0.00, 0.02 | |
| No. Obs. | 2,706 | ||
| Sigma | 0.656 | ||
| Abbreviation: CI = Confidence Interval | |||
sjPlot::plot_model(mv_model, type = "int")[[1]]
[[2]]