-
Notifications
You must be signed in to change notification settings - Fork 0
/
1.R
69 lines (50 loc) · 1.6 KB
/
1.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
library(dplyr)
library(readr)
library(ggplot2)
patient_index_data <- read_csv("./hospital.csv")
###NBDBJGBZ CysC MTP24H
patient_data <- patient_index_data %>%
filter(is.na(age) != T,
is.na(gender) != T,
is.na(MTP24H) != T,
is.na(CysC) != T,
is.na(NBDBJGBZ) != T,
is.na(CRE) != T,
CysC < 50,
CRE > 2 )%>%
distinct() %>%
mutate(ageEffect = if_else(gender == '男', 1, 0.742)) %>%
mutate(GFR = 30849 * (CRE^(-1.154)) * (age^(-0.203)) * ageEffect) %>%
mutate(GFR_CLASS = case_when(
GFR >= 90 ~ "正常",
GFR >= 60 & GFR <90 ~ "轻度下降",
GFR >= 30 & GFR <60 ~ "中度下降",
GFR >= 15 & GFR <30 ~ "重度下降",
GFR <15 ~ "肾衰竭",
TRUE ~ "未知"
))
patient_data %>% group_by(GFR_CLASS) %>% summarise(n())
#CysC GFR
CysC_GFR_plot <- patient_data %>%
#filter(NBDBJGBZ< 3)
select(CysC, GFR, GFR_CLASS)
ggplot(CysC_GFR_plot, aes(CysC, GFR, colour = GFR_CLASS)) +
geom_point()
#NBDBJGBZ GFR
NBDBJGBZ_GFR_plot <- patient_data %>%
select(NBDBJGBZ, GFR, GFR_CLASS)
ggplot(NBDBJGBZ_GFR_plot, aes(NBDBJGBZ, GFR, colour = GFR_CLASS)) +
geom_point()
#MTP24H GFR
MTP24H_GFR_plot <- patient_data %>%
select(MTP24H, GFR, GFR_CLASS)
ggplot(MTP24H_GFR_plot, aes(MTP24H, GFR, colour = GFR_CLASS)) +
geom_point()
#NBDBJGBZ CysC
NBDBJGBZ_CysC_plot <- patient_data %>%
select(NBDBJGBZ, CysC, GFR_CLASS)
ggplot(NBDBJGBZ_CysC_plot, aes(NBDBJGBZ, CysC, colour = GFR_CLASS)) +
geom_point()
#CysC GFR lm
NG_lm <- lm(GFR~NBDBJGBZ, data = NBDBJGBZ_GFR_plot)
summary(NG_lm)