R Notebook
R Notebook
R Notebook Code
loading libraries
Hide
library(tidyverse)
Hide
library(rsample)
library(broom)
Hide
list.files()
loading data
Hide
1 1 1 1
2 2 1 2
2 1 1 2
2 2 4 1
file:///C:/Users/THINKPAD/Desktop/cd/project.nb.html 1/8
22/05/2025 15:58 R Notebook
3 4 1 1
2 2 3 4
2 3 3 3
2 1 1 1
2 1 3 3
3 3 3 3
1 10 f 453 | 1 5 f 17 l P i 1 2 3 4 5 6 46 N t
Hide
glimpse(data)
Rows: 453
Columns: 17
$ satisfaction.in.RM <int> 1, 2, 2, 2, 3, 2, 2, 2, 2, 3, 3, 2, 3, 2, 2, 3…
$ Check.up.appointment <int> 1, 2, 1, 2, 4, 2, 3, 1, 1, 3, 1, 3, 2, 4, 3, 3…
$ Time.waiting <int> 1, 1, 1, 4, 1, 3, 3, 1, 3, 3, 1, 2, 1, 1, 3, 3…
$ Admin.procedures <int> 1, 2, 2, 1, 1, 4, 3, 1, 3, 3, 1, 2, 2, 1, 3, 3…
$ Hygiene.and.cleaning <int> 1, 1, 2, 1, 2, 1, 3, 1, 3, 3, 3, 2, 3, 1, 1, 3…
$ Time.of.appointment <int> 1, 2, 2, 2, 1, 1, 3, 1, 3, 3, 1, 2, 4, 1, 3, 3…
$ Quality.experience.dr. <int> 1, 2, 4, 4, 5, 4, 2, 1, 1, 3, 4, 4, 1, 4, 1, 1…
$ Specialists.avaliable <int> 1, 1, 4, 1, 5, 2, 2, 2, 3, 3, 1, 1, 2, 4, 3, 2…
$ Communication.with.dr <int> 1, 2, 4, 1, 5, 3, 2, 4, 3, 3, 1, 2, 2, 4, 1, 3…
$ Exact.diagnosis <int> 1, 1, 4, 4, 5, 3, 2, 4, 1, 3, 4, 2, 1, 4, 1, 3…
$ Modern.equipment <int> 1, 2, 1, 1, 2, 3, 2, 1, 3, 3, 1, 2, 4, 2, 3, 1…
$ friendly.health.care.workers <int> 1, 1, 4, 1, 5, 3, 2, 4, 3, 3, 1, 1, 3, 2, 3, 3…
$ lab.services <int> 1, 1, 4, 4, 5, 4, 2, 4, 5, 3, 1, 1, 4, 1, 1, 3…
$ avaliablity.of.drugs <int> 1, 1, 1, 5, 5, 2, 4, 1, 3, 3, 2, 2, 2, 1, 3, 2…
$ waiting.rooms <int> 1, 1, 2, 4, 1, 3, 2, 1, 3, 3, 2, 2, 2, 3, 3, 3…
$ hospital.rooms.quality <int> 1, 2, 2, 1, 1, 2, 3, 1, 3, 3, 2, 2, 3, 2, 3, 3…
$ parking..playing.rooms..caffes <int> 1, 1, 2, 1, 1, 3, 3, 1, 3, 3, 3, 1, 5, 2, 3, 3…
Hide
summary(data)
file:///C:/Users/THINKPAD/Desktop/cd/project.nb.html 2/8
22/05/2025 15:58 R Notebook
data %>%
distinct(satisfaction.in.RM)
file:///C:/Users/THINKPAD/Desktop/cd/project.nb.html 3/8
22/05/2025 15:58 R Notebook
satisfaction.in.RM
<int>
3 rows
Hide
data %>%
mutate(satisfaction.in.RM = as.factor(satisfaction.in.RM)) %>%
ggplot(aes(x =fct_infreq(satisfaction.in.RM )))+
geom_bar(fill = "red")+
coord_flip()+
labs(
title = "count of satisfaction",
x = "satisfation in RM",
caption = "figure by Dr.Kebbabi Abir"
)
Hide
Hide
file:///C:/Users/THINKPAD/Desktop/cd/project.nb.html 4/8
22/05/2025 15:58 R Notebook
data %>%
ggplot(aes(x =fct_infreq( Time.waiting)))+
geom_bar(fill = "blue")+
coord_flip()+
labs(
title = "waiting time",
x = "rate",
caption = "figure by Dr.Kebbabi Abir"
plotting function
Hide
Hide
barplots(data$Hygiene.and.cleaning , "darkgreen")
file:///C:/Users/THINKPAD/Desktop/cd/project.nb.html 5/8
22/05/2025 15:58 R Notebook
Hide
barplots(data$Quality.experience.dr. , "darkred")
Hide
file:///C:/Users/THINKPAD/Desktop/cd/project.nb.html 6/8
22/05/2025 15:58 R Notebook
set.seed(123)
data_split <- initial_split(data_model , prop = 0.8 , strata = satisfaction.in.RM )
train <- training(data_split)
test <- testing(data_split)
Hide
Hide
accuracy function
Hide
Hide
ms(test$satisfaction.in.RM , pred)
file:///C:/Users/THINKPAD/Desktop/cd/project.nb.html 7/8
22/05/2025 15:58 R Notebook
[1] 0.2928149
file:///C:/Users/THINKPAD/Desktop/cd/project.nb.html 8/8