install.packages("readxl")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/User/AppData/Local/R/win-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/readxl_1.4.3.zip'
Content type 'application/zip' length 1202510 bytes (1.1 MB)
downloaded 1.1 MB
package ‘readxl’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\User\AppData\Local\Temp\RtmpgX9kRp\downloaded_packages
install.packages("openxlsx")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/User/AppData/Local/R/win-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/openxlsx_4.2.5.2.zip'
Content type 'application/zip' length 2370571 bytes (2.3 MB)
downloaded 2.3 MB
package ‘openxlsx’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\User\AppData\Local\Temp\RtmpgX9kRp\downloaded_packages
install.packages("ggplot2")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/User/AppData/Local/R/win-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/ggplot2_3.5.1.zip'
Content type 'application/zip' length 5012105 bytes (4.8 MB)
downloaded 4.8 MB
package ‘ggplot2’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\User\AppData\Local\Temp\RtmpgX9kRp\downloaded_packages
#install.packages("tidyverse")
install.packages("multcomp")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/User/AppData/Local/R/win-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/multcomp_1.4-25.zip'
Content type 'application/zip' length 748772 bytes (731 KB)
downloaded 731 KB
package ‘multcomp’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\User\AppData\Local\Temp\RtmpgX9kRp\downloaded_packages
install.packages("magick")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘C:/Users/User/AppData/Local/R/win-library/4.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.4/magick_2.8.3.zip'
Content type 'application/zip' length 24788347 bytes (23.6 MB)
downloaded 23.6 MB
package ‘magick’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\User\AppData\Local\Temp\RtmpgX9kRp\downloaded_packages
Upload the file into the dataframe
library(readxl)
library(ggplot2)
library(tidyverse)
library(multcomp)
library(dplyr)
library(magick)
data <- read_excel("C:\\Users\\User\\Desktop\\SignInSurvey.xlsx")
print(data)
summary(data)
Id Design1 Design2 Design3 Design4
Min. : 1.00 Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
1st Qu.:19.25 1st Qu.:4.000 1st Qu.:3.000 1st Qu.:4.000 1st Qu.:2.000
Median :37.50 Median :5.000 Median :4.000 Median :5.000 Median :4.000
Mean :37.50 Mean :4.932 Mean :4.081 Mean :4.838 Mean :3.486
3rd Qu.:55.75 3rd Qu.:6.000 3rd Qu.:5.750 3rd Qu.:6.000 3rd Qu.:5.000
Max. :74.00 Max. :7.000 Max. :7.000 Max. :7.000 Max. :7.000
# เปลี่ยนรูปแบบจาก wide เป็น narrow
data2 <- data %>%
pivot_longer(cols = starts_with("Design"),
names_to = "variable",
values_to = "value") %>%
mutate(variable = as.factor(variable))
# print(data3)
#คำนวณ mean & SD เพื่อนำไปใช้ในการสร้าง Error Bar
summary_data <- data2 %>%
group_by(variable) %>%
summarize(
mean_value = mean(value),
se = sd(value) / sqrt(n()))
print(summary_data)
NA
#สร้างกราฟแท่งจาก Mean ของแต่ละแบบ พร้อมใส่ Error Bar
ggplot(summary_data, aes(x = variable, y = mean_value)) +
geom_bar(stat = "identity", fill = "orange", width = 0.6) +
geom_errorbar(aes(ymin = mean_value - se*1.96, ymax = mean_value + se*1.96), width = 0.2) +
geom_text(aes(label = round(mean_value, 2), y = mean_value), vjust = -0.5, , hjust = -0.3, size = 3, color = "blue") +
labs(title = "กราฟแสดงผลความพึงพอใจของแต่ละหน้าจอ SignIn", x = "รูปแบบหน้าจอ", y = "ระดับความพึงพอใจ")
# การวิเคราะห์ ANOVA เพื่อดูผลภาพรวมความต่างว่ามีนัยสำคัญหรือไม่
anova_result <- aov(value ~ variable , data = data2)
summary(anova_result)
Df Sum Sq Mean Sq F value Pr(>F)
variable 3 103.2 34.39 11.78 2.64e-07 ***
Residuals 292 852.7 2.92
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
จากผลการวิเคราะห์ด้านบนสรุปได้ว่าค่า P Value< 0.05 จึงสรุปได้ว่าระดับความพึงพอใจของไอคอนเหล่านั้นมีความแตกต่างกันอย่างมีนัยสำคัญ
#แล้วมาเปรียบเทียบทีละคู่ว่าต่างกันอย่างมีนัยสำคัญหรือไม่
posthoc_result <- glht(anova_result, linfct = mcp(variable = "Tukey"))
summary(posthoc_result)
Simultaneous Tests for General Linear Hypotheses
Multiple Comparisons of Means: Tukey Contrasts
Fit: aov(formula = value ~ variable, data = data2)
Linear Hypotheses:
Estimate Std. Error t value Pr(>|t|)
Design2 - Design1 == 0 -0.85135 0.28094 -3.030 0.0138 *
Design3 - Design1 == 0 -0.09459 0.28094 -0.337 0.9868
Design4 - Design1 == 0 -1.44595 0.28094 -5.147 <0.001 ***
Design3 - Design2 == 0 0.75676 0.28094 2.694 0.0371 *
Design4 - Design2 == 0 -0.59459 0.28094 -2.116 0.1503
Design4 - Design3 == 0 -1.35135 0.28094 -4.810 <0.001 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Adjusted p values reported -- single-step method)
จากผลการวิเคราะห์ด้านบนที่นำแต่ละการออกแบบหน้าจอมาเปรียบเทียบกันจะเห็นได้ว่าการออกแบบหน้าจอลงชื่อเข้าใช้งานแบบที่ 1 กับแบบที่ 3 นั้นมีระดับผลความพึงพอใจเฉลี่ยไม่ต่างกันมากแล้วทั้งสองแบบมีค่าความแตกต่างทางสถิติที่ไม่ต่างกันอย่างมีนัยยะสำคัญ จึงสรุปได้ว่าเราสามารถใช้แบบใดแบบหนึ่งในการพัฒนาการออกแบบหน้าจอของระบบ