I would like to build a decision tree (DT) model to answer my question based on tgis: "Decision is Yes if (EF =< 25 or SB=< 100) and (CR>1.8 or NT<136 or BU>40), otherwise No." But I am having a hard time setting the levels at <,=,> in my code. Just to start with I simply tried the one below. Appreciate your assistance. Thank you!
HF <- HF %>%
mutate(EF = fator(EF, levels =c(=<25, >25), labels=C('=<25%','>25%)),
Decision = factor(Decision, levels = c(0,1), labels = c('No','Yes'))) % > %
na.omit()
HF <- data.frame(EF,SB,DB,CR,NAT,BU,Decision)
structure(list(EF = c(15, 20, 22, 24, 25, 55, 60, 18),
SB = c(89, 103, 117, 94, 119, 91, 144, 100), DB = c(26,
50, 58, 47, 28, 50, 60, 59), CR = c(1.5, 1.7, 1.1, 2.1,
0.7, 1.4, 0.9, 1.2), NT = c(126, NA, 134, 138, 139, 140,
141, 134), BU = c(72, 38, 27, 61, 18, 33, 19, 42), Decision = structure(c(1L,
2L, 1L, 1L, 2L, 1L, 1L, 2L), .Label = c("No", "Yes"), class = "factor")), class = "data.frame", row.names = c(NA,-8L))