library(readxl)
library(gtsummary)
## #Uighur
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.4
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.0 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.0
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
data <- read_excel("dataset.xlsx")
data$regitro_hipertensivo<-ifelse(data$`PAS 1`>139 | data$`PAS 2`>139 | data$`PAD 1`>89 | data$`PAD 2`>89, 1, 0)
data$bmi<-data$Peso/((data$Altura/100)^2)
data$sexo<-factor(data$sexo, labels=c("Masculino", "Femenino"))
#1. no hipertensos conocidos============================================
no_hipertensos<-data %>% filter(hta_previo==0)
##1.1 descriptivos
no_hipertensos %>% select(años, sexo, dbt, dlp, smoke, regitro_hipertensivo) %>%
tbl_summary(by=regitro_hipertensivo) %>%
add_overall()%>%
add_p()
| Characteristic |
Overall, N = 193 |
0, N = 108 |
1, N = 85 |
p-value |
| años |
47 (34, 58) |
41 (30, 55) |
53 (42, 63) |
<0.001 |
| sexo |
|
|
|
0.3 |
| Masculino |
117 (61%) |
69 (64%) |
48 (56%) |
|
| Femenino |
76 (39%) |
39 (36%) |
37 (44%) |
|
| dbt |
10 (5.3%) |
6 (5.6%) |
4 (4.9%) |
>0.9 |
| Unknown |
4 |
1 |
3 |
|
| dlp |
33 (18%) |
17 (16%) |
16 (20%) |
0.5 |
| Unknown |
5 |
1 |
4 |
|
| smoke |
|
|
|
0.7 |
| 0 |
144 (75%) |
83 (77%) |
61 (72%) |
|
| 1 |
32 (17%) |
17 (16%) |
15 (18%) |
|
| 2 |
17 (8.8%) |
8 (7.4%) |
9 (11%) |
|
##1.2 predictores de registros hipertensivos en sujetos no hipertensos conocidos
names(data)
## [1] "id" "años"
## [3] "sexo" "hta_previo"
## [5] "Peso" "Altura"
## [7] "PAS 1" "PAD 1"
## [9] "PAS 2" "PAD 2"
## [11] "FC 2" "tensiometro"
## [13] "drogas_n" "IEC 0ARA0 BC0 BB0 DIU 0AA"
## [15] "smoke" "dlp"
## [17] "dbt" "ACV_IAM"
## [19] "MAPA" "n_visitas"
## [21] "regitro_hipertensivo" "bmi"
model<-glm(regitro_hipertensivo~años+Altura+Peso+sexo+dbt+dlp, data=no_hipertensos, family = "binomial")
tbl_regression(model, exp=T)
| Characteristic |
OR |
95% CI |
p-value |
| años |
1.04 |
1.02, 1.06 |
<0.001 |
| Altura |
1.01 |
0.95, 1.06 |
0.8 |
| Peso |
1.02 |
1.00, 1.04 |
0.066 |
| sexo |
|
|
|
| Masculino |
— |
— |
|
| Femenino |
1.04 |
0.42, 2.58 |
>0.9 |
| dbt |
0.39 |
0.09, 1.57 |
0.2 |
| dlp |
1.20 |
0.53, 2.72 |
0.7 |
data %>% ggplot(aes(y=años,x=regitro_hipertensivo, fill=as.factor(regitro_hipertensivo)))+
geom_boxplot()
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`stat_boxplot()`).
## Warning: Removed 1 row containing non-finite outside the scale range
## (`stat_boxplot()`).

#2. mal control====================================================
hipertensos<- data %>% filter(hta_previo==1)
hipertensos %>% select(años, sexo, dbt, dlp, smoke, regitro_hipertensivo) %>%
tbl_summary(by=regitro_hipertensivo) %>%
add_overall()%>%
add_p()
## 1 observations missing `regitro_hipertensivo` have been removed. To include these observations, use `forcats::fct_na_value_to_level()` on `regitro_hipertensivo` column before passing to `tbl_summary()`.
| Characteristic |
Overall, N = 186 |
0, N = 63 |
1, N = 123 |
p-value |
| años |
63 (54, 73) |
63 (54, 74) |
63 (54, 70) |
>0.9 |
| Unknown |
1 |
0 |
1 |
|
| sexo |
|
|
|
0.026 |
| Masculino |
109 (59%) |
44 (70%) |
65 (53%) |
|
| Femenino |
77 (41%) |
19 (30%) |
58 (47%) |
|
| dbt |
45 (24%) |
16 (25%) |
29 (24%) |
0.8 |
| Unknown |
1 |
0 |
1 |
|
| dlp |
81 (44%) |
27 (44%) |
54 (44%) |
>0.9 |
| Unknown |
2 |
1 |
1 |
|
| smoke |
|
|
|
0.3 |
| 0 |
120 (65%) |
36 (57%) |
84 (68%) |
|
| 1 |
24 (13%) |
10 (16%) |
14 (11%) |
|
| 2 |
42 (23%) |
17 (27%) |
25 (20%) |
|