-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormulasR.R
39 lines (36 loc) · 1.01 KB
/
FormulasR.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
healthyness <- function(df){
Healthy <- logical(nrow(df))
HDL.LEVEL <- character(nrow(df))
ColesterolFaixa <- character(nrow(df))
Displazia <- logical(nrow(df))
for(i in 1:nrow(df)){
Healthy[i] <- TRUE;
if (df$HDL[i] != "NA" && df$HDL[i] < 40){
HDL.LEVEL[i] <- "Baixo"
Healthy[i] <- FALSE;
}
else if (df$HDL[i] < 60){
HDL.LEVEL[i] <- "Medio"
}
else if (df$HDL[i] >= 60){
HDL.LEVEL[i] <- "Desejável"
}
if (df$Colesterol[i] < 200){
ColesterolFaixa[i] <- "Desejável"
}
else if (df$Colesterol[i] <= 239){
ColesterolFaixa[i] <- "Limítrofe"
}
else if (df$Colesterol[i] > 239){
ColesterolFaixa[i] <- "Alto"
Healthy[i] <- FALSE;
}
if (((df$Sexo[i] == "female" && df$HDL[i] < 50)|| (df$Sexo[i] == "male" && df$HDL[i] < 40)) && df$Pressao.Sistolica[i] >= 130 && df$Pressao.Diast[i] >= 85 && df$Glicose >= 100){
Displazia[i] <- TRUE
Healthy[i] <- FALSE;
}
else{
Displazia[i] <- FALSE
}
}
}