Boxplot and histogram using R

1. Boxplot

1.1 One variable
score = c(12, 14, 17, 13, 19, 28, 20, 9, 3, 6, 5, 11, 12, 17, 16, 8, 6, 2)
boxplot(score, col = c("salmon3"))

1.2 Two variables
scoreA = c(12, 14, 17, 13, 19, 28, 20, 9, 3, 6, 5, 11, 12, 17, 16, 8, 6, 2) 
scoreB = c(13, 4, 7, 3, 15, 38, 20, 9, 3, 6, 5, 11, 2, 27, 6, 8, 6, 2) 
boxplot(scoreA, scoreB, col = c("orange", "olivedrab"), horizontal = TRUE, names = c("Τμήμα A", "Τμήμα B"))

2. Histogram
hist(score, col = c("royalblue3"), main = "Ιστόγραμμα τιμών", xlab = "Βαθμός", ylab = "Συχνότητα")

Comments